Hi all,
I’m trying to do rubber band drawing in Windows using GL_COLOR_LOGIC_OP and GL_XOR. I tried to do this in the following way:
- draw straight to the front buffer using
glDrawBuffer( GL_FRONT );
DrawRubberBand();
glDrawBuffer( GL_BACK );
But everytime I try to write to the front color buffer the image gets corrupted, i.e. a garbled version of my original image.
So then I tried the follwing:
- Copy the front buffer to the back buffer, draw the rubber band line and then swap buffers:
glFinish(); //just to be safe - makes no difference!
glDrawBuffer( GL_BACK );
glRasterPos2i( 0, 0 );
glReadBuffer( GL_FRONT );
glCopyPixels( 0, 0, wndRect.Width(), wndRect.Height(), GL_COLOR );
DrawRubberBand();
SwapBuffers( hDC );
Still get the same result!
Can anyone suggest what may be wrong here? I would like to be able to do this without using overlay planes but maybe that’s the best approach for this.
By the way this is in a Windows MDI app and when the app and current opengl enabled cview are maximized the color buffers are both fine. However, if either the app or the window is not maximized then the I get the problem described above!?
Thanks,
B