PDA

View Full Version : Single buffered rendering



hlewin
08-18-2013, 01:24 PM
A while ago I wanted to try out single-buffered rendering under Windows as the final Screen-Rendering would have been a simple full-Screen-quad with a texture representing the whole Scene. I created a window without the double-buffered-flag and tried rendering the quad directly into the front-buffer. I got a black Screen. Just for fun I tried rendering into the backbuffer (which should not be there) and got the scene rendered correctly but a also gl-Error.
Is rendering single-buffered just possible under Windows and NVIDIA-hardware?
Is the behaviour described above expected? Is it a bug somewhere (either in my code or as such operation is non-supported)?
Will rendering a full-screen quad cause flickering?

Just curios - rendering double-buffered works fine...

mhagain
08-18-2013, 04:10 PM
Try a glFlush at the end of your scene. Yes, single buffered rendering is possible (judging by the number of people who follow outdated GLUT tutorials and create single buffered contexts) but on modern Windows is meaningless as the DWM means that all contexts are double buffered by default anyway. A quick Google search for "opengl windows black screen" would have given you all the information you needed here. Wanting to create a single buffered context just for the hell of it seems a lot like pointless nitpicking IMO.

hlewin
08-18-2013, 04:23 PM
Didn't seem to be worth the trouble, you're right. I'm sorry.
That few mb of additional memory that could potentially have been saved won't hurt so much I guess.

mhagain
08-19-2013, 03:01 PM
It's worth adding here that single buffered/double buffered is part of context creation, which OpenGL itself doesn't specify but which is left to the windowing system. It's perfectly permissible for one windowing system to not have robust support for single buffered contexts, just as it would be perfectly permissible for a hypothetical other windowing system to not have any support at all for double buffered contexts.

A few MB of memory saving is not much nowadays; we're in the desktop GL forums, not the ES forums, so mobile and mobile constraints are not relevant here - we're talking the equivalent of a handful of textures worth, really. There's bigger, more important stuff to focus one's energys at.