Advertisement

Double buffering

Started by August 16, 2003 08:47 PM
3 comments, last by ChrisMan44 21 years, 6 months ago
I''ve written a few apps in opengl and am using the NeHe basedcode, I know the basecode asks for a double-buffered window. So where does this play into my program? I''ve never seen mentioned any functions dealing with a double buffer. I tried DirectX a bit and you explicitly switched buffers, but how would OpenGL know when to switch?
clear framebuffer
draw stuff
swapbuffers

double buffer is the viewed buffer and the frame buffer.
one you look at and one you draw to. swap buffers!
and they change types. Great for not drawing directly to the scene and getting ''torn'' images, unless vsync is off.

Bobby
Game Core
Advertisement
In the nehe basecode, close to the end of the winmain function there is a call:

SwapBuffers(hDC);

This is the function that swtches the buffers .... look more carefully next time
it''s in the piece of code that creates and sets the PixelFormat, notice the PFD_DOUBLE_BUFFER in the pfd initialization code.
Ah, hehe, thanks guys, hadn''t seen that.

This topic is closed to new replies.

Advertisement