Can you create OpenGL context without opening a window?

后端 未结 3 876
生来不讨喜
生来不讨喜 2020-12-05 04:20

Occassionally I hit places where I\'d want to get an OpenGL framebuffer object, but where I\'m not interested about opening a window of any kind.

Is it possible to c

相关标签:
3条回答
  • 2020-12-05 05:14

    http://www.opengl.org/wiki/Creating_an_OpenGL_Context

    According to this Web page, WGL_ARB_create_context can be used to create a context without a window. I have not actually tried it myself. I used freeGLUT to create the context and then rendered off-screen to a framebuffer+renderbuffer. I exit the program without ever calling glutMainLoop. It is klugy, but it works for my purposes.

    0 讨论(0)
  • 2020-12-05 05:15

    Yes, you can perform off-screen rendering with OpenGL, but the exact way to set it up is dependent on the operating system. The closest you get to an OS independent way would be to use Mesa 3D, but then your off-screen rendering would not be hw accelerated.

    0 讨论(0)
  • 2020-12-05 05:25

    Yes! you can use the desktop window as the window passed to OpenGL- as long as you don't try to display anything on it ;)

    Just Call GetDesktopWindow and pass the result as an argument when creating new OpenGL window.

    0 讨论(0)
提交回复
热议问题