Minimal Windowless OpenGL Context Initialization

前端 未结 3 1243
栀梦
栀梦 2021-01-02 16:59

How can I initialize a windowless OpenGL context with the minimal amount of code?

I\'ve read here that you can use wglCreateContextAttribsARB to create

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 17:33

    The usual way to implement offscreen rendering is:

    1. Create a dummy window + OpenGL context to get access to extensions
    2. Obtain the functions to create a PBuffer
    3. Create a PBuffer DC
    4. Create an OpenGL context on the PBuffer
    5. Destroy the dummy window

    Another option is using Framebuffer Objects (FBO) by which you create a regular OpenGL window, but instead of rendering to the main framebuffer you render to Framebuffer Object buffers, with the OpenGL window being made invisible.

提交回复
热议问题