PDA

View Full Version : doublebuffer doesn't work



Tux
02-11-2002, 06:35 AM
when i use PFD_DOUBLEBUFFER the window is gray, without its the normal black starting scene.
whats that?
there some inits necessary?

thx.

Andrea Rossini
02-11-2002, 06:51 AM
Did you setup everything?
Do you have a current Rendering Context?
Do you call SwapBuffers or wglSwapLayerBuffers?

if your problem is one of these ok else I don't know. I'm more beginner than you

Tux
02-11-2002, 07:22 AM
i have RC and DC. and it works (without doublebuffer).
using glFlush to to draw the scene but with
swapbuffers there is the same problem!?

Andrea Rossini
02-11-2002, 07:28 AM
Mmmmh...
can I see you pixel format?

Tux
02-11-2002, 08:25 AM
its Delphi-Source (nearly the same)

// there are my variables
var pfd : TPixelFormatDescriptor;
nPixelFormat : Integer;

// and here it start
begin
// set the whole pfd = 0
FillChar(pfd, SizeOf(pfd), 0);

with pfd do
begin
nSize := SizeOf(pfd);
nVersion := 1;
dwFlags := PFD_DRAW_TO_WINDOW or
FD_SUPPORT_OPENGL
or PFD_DOUBLEBUFFER;
iPixelType := PFD_TYPE_RGBA;
cColorBits := 24;
cDepthBits := 32;
iLayerType := PFD_MAIN_PLANE;
end;

nPixelFormat := ChoosePixelFormat(Handle, @pfd);
SetPixelFormat(Handle, nPixelFormat, @pfd);

tcobbs
02-11-2002, 09:44 PM
This may sound like a silly question, but are you drawing to the back buffer? In other words, do you have the following in your code before you start drawing:

glDrawBuffer(GL_BACK);

Or, more to the point, since I think this is the default for double buffered rendering contexts, did you make sure to NOT call:

glDrawBuffer(GL_FRONT);

--Travis Cobbs


[This message has been edited by tcobbs (edited 02-11-2002).]

Tux
02-12-2002, 05:51 AM
It doesn't work with glDrawBuffer(..) http://www.opengl.org/discussion_boards/ubb/frown.gif

Problem is not that there is nothing show on the black black start-screen, problem is:
NO INITIALIZATION FOR THE BLACKSCREEN!
and so on NO BLACKSCREEN.

i'm so frustrated;

marcus256
02-12-2002, 06:55 AM
You are talking about a black start screen... To guarantee that you really get a black screen before any rendering starts, do either this:



glDrawBuffer( GL_FRONT );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT );
glFinish();
glDrawBuffer( GL_BACK );

That clears your front buffer (which is the visible buffer). Or you can do this (assuming that you have not modified the drawing buffer):



glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT );
SwapBuffers

That clears your back buffer, and then swaps it to the front buffer.