tags:

views:

783

answers:

2

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 create an opengl context without attaching it to a window of any kind?

+4  A: 

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.

Dror Helper
Does this also work for xorg? When tried it seemed to open the context well, but I didn't try open a framebuffer object and render.
Cheery
I know it works on DirectX as well but I never tried using this trick with xorg
Dror Helper
+2  A: 

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.

Ronny Vindenes