PDA

View Full Version : swapbuffer, call in second thread ??



misanel
04-03-2002, 06:27 PM
hi all.
in windows2000, i found the swapbuffer..
are called not in main thread but another
thread.
i need to be notified when
the swaping operation complete.
so i can continue render new frame
to backbuffer.
how can i???

immy
04-03-2002, 08:04 PM
Hi
I think the nice way is to make a boolean variable true or false.
I mean when u start drawing set
bRendering = TRUE
& when rendering is complete set
bRendering = FALSE

define & declare this variable as
volatile BOOL bRendering=TRUE;

call swap buffers if rendering is FALSE otherwise don't call it. Thats it

misanel
04-03-2002, 09:40 PM
hi,
i just wanna to know when the rending
complete. see the following codes:

glDrawSomething1(...);
glFinish();
SwapBuffers(hdc);
glDrawSomething2(...);

when call glDrawSomething2(..), i
need be sure the Swapbuffers(hdc) has
complete. because the SwapBuffers(hdc)
call a new thread to copy backbuffer to
front buffer, so i don't know when it
complete.