Archived

This topic is now archived and is closed to further replies.

Finir

Problems with SwapBuffers()

Recommended Posts

Hi, i need a few new ideas or respective a few tips. In the last days i thought about the optimization of my 3D Render Engine and i have found the following problem. The SwapBuffers() is in my opinion to expensive. The current Testscene is very small (only a few cubes). The complete drawing is done in about 3 - 4 ms and the SwapBuffers() Function needs 11 - 14 ms. I have thought about these problem and i have trying to set the Flags PFD_SWAP_COPY or PFD_SWAP_EXCHANGE in the PixelFormatDescriptor ... yes i know these flags are only hints but anything i have done has changed nothing. Hmm, as a next step i have verified the hardware acceleration with my selected PixelFormat ... it´s activated! I have installed the newest Drivers for my Graphic Card but nothing helps ... If you have an idea, please help me :-) Here a few informations about my system: Win98, Geforce3 ... do you need more informations???

Share this post


Link to post
Share on other sites
They're completely unrelated.

swapbuffers is a GDI command to swap the back and front buffer.
glFlush is a GL command to clear the command buffers in the graphics card.

____________________________________________________________
www.elf-stone.com

[edited by - benjamin bunny on May 2, 2002 7:34:34 AM]

Share this post


Link to post
Share on other sites
glFlush

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
Thank you benjamin bunny :-) (nice name)
i have turned off the VSYNC and it´s great, the first step is done :-) The time for SwapBuffers() is now by 6-8 ms. That´s a great boost for my Framerate ( ... or better for the framerate of my application :-) ). But now it should be possible to accelerate these function. 3-4 ms for drawing and 6-8 ms for SwapBuffers() ... that´s still to much. Has anyone another idea to accelerate these function??? At my opinion it should only be a exchange of 2 Pointers. Yes i know, it´s a little bit naive, but what´s happen in these invidious function?

Share this post


Link to post
Share on other sites
Hi Maverick the divider,
you need SwapBuffers() if you use doublebuffers in your application. This means: you render in a not visible buffer and switch these buffers if you have completed the rendering. And now at these moment the Graphic Hardware will be render these buffer and you have another not visible buffer to render.
glFlush() has a complete other meaning. With glFlush() you force OpenGL to flushes the network and wait for notification from the graphics hardware that the drawing is complete.

Share this post


Link to post
Share on other sites