OpenGL Discussion and Help Forums
>
OpenGL Developers Forum
>
OpenGL coding: beginners
> offscreen rendering without a window
PDA
View Full Version :
offscreen rendering without a window
akane
06-19-2009, 09:59 AM
Hi! my question is if there is a way which allows me to create an opengl rendering context without the need of creating a window. It's posible using FBO?
Ilian Dinev
06-19-2009, 10:05 AM
No, at minimum you can create a hidden window of whatever size. But a window is a-must-have.
akane
06-19-2009, 10:16 AM
thanks!
overlay
06-19-2009, 02:16 PM
Actually, since OpenGL 3.0, you can:
"If both <draw> and <read> are None, [...]; if the OpenGL version is 3.0 or greater, the context is made current without a default framebuffer. The meaning of this is defined in chapter 4 of the OpenGL 3.0 Specification. If <ctx> is NULL and <draw> and <read> are not None, BadMatch is generated."
Basically, you just have to call that:
glXMakeContextCurrent(display,None,None,context);
and then you create an FBO that you attached to the DRAW_BUFFER_BINDING and another one (or the same one) to the
READ_BUFFER_BINDING and you are good to go.
dletozeun
06-22-2009, 03:27 AM
Note that it seems to not be supported yet on Windows:
4) Should there be a way to make a context current without binding
it to a window system drawable at the same time?
RESOLVED: Yes, but only in OpenGL 3.0 and later. This results in a
context with an invalid default framebuffer, the meaning of which is
defined in the OpenGL 3.0 specification.
NOTE: Apparently on Windows, opengl32.dll makes use of the drawable
argument to identify the namespace of the driver, so we may not be
able to work around it.
ldlhp
06-25-2009, 07:59 AM
Hi, I have tried different combinations, but basically am still getting BadMatch for the glXMakeContextCurrent() call. My question is if I have to use the call glXCreateContextAttribsARB() to get the context? Did anybody ever succeeded in rendering in a window-less setup?
Dark Photon
06-25-2009, 10:02 AM
Hi, I have tried different combinations, but basically am still getting BadMatch for the glXMakeContextCurrent() call.
You may have already checked this, but from the man page ():
BadMatch is generated if draw and read are not compatible.
....
And the Linux man page for glXMakeCurrent says:
BadMatch is generated if drawable was not created with the same X screen and visual as ctx. It is also generated if drawable is None and ctx is not NULL.
Haven't actually tried the new API, but IIRC back from my X11 days, BadMatch frequently meant you didn't have a colormap attached to the window (see this thread ( ge=1&Main=47488&Words=glXCreateContext&Search=true #Post241530)). Not quite your case because you're trying to do this without a window. In general, look for things that aren't set up compatibly.
ldlhp
06-25-2009, 12:13 PM
Thanks. But in my case, the draw/read are both None. I am using GLX 1.4 and GL 3.0 and ARB_create_context is supported. Based on, window-less context is supposed to be supported.
Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.