PDA

View Full Version : Context for Renderbuffer off-screen rendering?



Simon Watson
03-01-2006, 08:39 AM
Hi there, I'm developing a web-based (Apache module) extension that I'd like to use OpenGL rendering for. The idea is that an HTTP response will be used to create a rendered bitmap which is returned in the request. I'd ideally like it to do all of its rendering off-screen, without being tied to any particular windowing system.

I've looked at pbuffers but have concluded that EXT_framebuffer_object is the way forward. I was under the impression that these new extensions are designed to operate independently of the underlying windowing system. However, the spec states "There is always one window-system-provided framebuffer, while application-created framebuffers can be created as desired."

So, I'm a little confused and, in particular, am unsure how I should obtain/create a GL context to operate in. Do I still need to create a window to get a context? If so, this seems to remove one of the potential advantages of FBOs.

I've seen pbuffer hacks where a window is created and hidden but I was hoping to avoid this.

I'm currently developing on Win32 win GNU tools in the hope of being able to easily port the code to other platforms.

Any insights/suggestions would be much appreciated.

Simon.

grisha
03-01-2006, 09:16 AM
You still need to create a window, but it isn't necessary to show it on screen.

So create 'fake' window, create OpenGL context from it, then create FBOs and render into them.

knackered
03-01-2006, 09:25 AM
There should be a little platform independent library to do this for people.

GLRC glzCreateContext(int colourBits, int depthBits, int stencilBits);
glzBeginRender(GLRC);
glzEndRender(GLRC);

That'd be enough.

Simon Watson
03-01-2006, 09:49 AM
Thanks for the replies, it's a shame to have my fears confirmed that I do need to create a hidden window. I guess there's something about the GL driver model that requires a windowing system to create the appropriate context. Fair enough, I suppose, given that most Gl apps are on-screen.

In terms of a platform-independent library to do this, I agree. Personally I think it would be a good addition to GLUT, given that it already abstracts the windowing system.

knackered
03-01-2006, 12:21 PM
I wouldn't even put it in glut, just those 4 functions (it'll need a glvDestroyContext() function).
Ultra light, just 'give me the ability to use the GL API on this OS, forgetting windows for now.'.