PDA

View Full Version : Windows Clipping Region



chief
07-01-2002, 01:05 AM
In order to speed up the repainting in my program i chatch the Clipping Region of the WM_PAINT message and, if present, i use the Microsoft extension function "GL_WIN_swap_hint" forcing the swapping area to the Paint Clipping Region. But if this extension is not supported where is the best choice ?
(currently i using:

glReadBuffer(GL_BACK);
glDrawBuffer(GL_FRONT);
//
::glCopyPixels(m_rcClipBox.left ,
m_rcClipBox.top ,
m_rcClipBox.Width() ,
m_rcClipBox.Height(),
GL_COLOR);
//
::glDrawBuffer(GL_BACK);

but this appear more slow than "GL_WIN_swap_hint" also for a lot o state save and restore).
Any suggestion ?. Thancks in advance and sorry for my poor english.

Relic
07-01-2002, 01:54 AM
WIN_swap_hint is, as the name says, a mere hint. It just gathers rectangles and tries to do an optimized SwapBuffers.
If you don't find the extension, use SwapBuffers as usual if your CopyPixels is not fast enough.
WIN_swap_hint only makes sense for pixelformats with PFD_SWAP_COPY flag set. There are OpenGL implementations which can flip the addresses of the front and back buffer without copying the data (PFD_SWAP_EXCHANGE flag). Using WIN_swap_hint is pretty useless here.