Logic op blending inside QGLWidget

I am having problems getting a blending equation to work inside a QGLWidget. This works fine for me on a system where I use 8-bit color indexing mode but now I am on a system that can use 24-bit colors. I am trying to draw a box based on the user’s mouse clicking and dragging. Here is what my code looks like:

 
if( mDrawBoxZoom == true )
{
   setAutoBufferSwap( false );
   qglColor( mPlotBoxZoomColor );
   glDrawBuffer( GL_FRONT );
   glLogicOp( GL_XOR );
   glEnable( GL_COLOR_LOGIC_OP );
   glEnable( GL_BLEND );
   glBlendEquationEXT( GL_COLOR_LOGIC_OP );
   glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
   glLineWidth( 2.0 );
   // Draw back over the previously drawn box
   glBegin( GL_LINE_LOOP );
      glVertex3d( mBeginDrawBox[0], mBeginDrawBox[1], 0.0 );
      glVertex3d( mBeginDrawBox[0], mOldEndDrawBox[1], 0.0 );
      glVertex3d( mOldEndDrawBox[0], mOldEndDrawBox[1], 0.0 );
      glVertex3d( mOldEndDrawBox[0], mBeginDrawBox[1], 0.0 );
   glEnd( );
   // Draw the new box with the current mouse position
   glBegin( GL_LINE_LOOP );
      glVertex3d( mBeginDrawBox[0], mBeginDrawBox[1], 0.0 );
      glVertex3d( mBeginDrawBox[0], mEndDrawBox[1], 0.0 );
      glVertex3d( mEndDrawBox[0], mEndDrawBox[1], 0.0 );
      glVertex3d( mEndDrawBox[0], mBeginDrawBox[1], 0.0 );
   glEnd( );
   glFlush( );
   glLineWidth( 1.0 );
   glDisable( GL_COLOR_LOGIC_OP );
   glDisable( GL_BLEND );
   glDrawBuffer( GL_BACK );
   setAutoBufferSwapping( true );
}
 

mDrawBoxZoom is set to true when the mouse button is clicked and set to false when the mouse button is released. I do other painting code when the box is not being drawn but this is the part that is not working. Like I said earlier it works fine when I am in 8-bit color indexing mode but not when I am in 24-bit color. The qglColor( ) call is similar to making a glColor*( ) call. My problem is I am capturing all my mouse coordinates correctly which I store in my 3 2-member arrays mBeginDrawBox, mOldEndDrawBox, and mEndDrawBox. These values are correct but I cannot see any box being drawn. I can see some flicker when I move my mouse so I know it’s drawing to the front buffer but for some reason I cannot see the box being drawn. Thanks for your help in helping me to try and figure out why I cannot see my mouse.

Edit:
I need to take out the setAutoBufferSwapping( true ); at the end of my if-statement and put this line in the code where I need to swap the buffers. After doing that things work a little better but not good enough. What happens is 25-50% of the time my box draws correctly and the rest of the time the box does not draw although my debug statements all print out like it should be drawing. I have tried taking out the blending and logic op calls and the only thing that changes is all of my old boxes stay on the screen until I release the mouse button but again this only works 25-50% of the time. I have also tried not using qglColor( ) but rather using glColor3i( ), glColor3f( ), glColor4i( ), and glColor4f( ) and these all behave the same way as qglColor( ). It only works 25-50% of the time. I am working on Solaris 8. I was on Solaris 5.9 when I used the color index mode but installed the same OpenGL drivers on both machines so I know they have the same version of OpenGL. Does anyone see any fault in my code? Thanks for your help again!

bump…anybody have any ideas??

I’m really not sure about this, but generally when you create your GL drawable, you might need to stipple how colors are treaten, ie, using color indexing or true color mode… but I might be totally wrong.

At first glance I don’t see any bad things in your code.

Well I was able to port this code onto a Linux box and everything worked as I expected it to work. So I am guessing it is some hardware limitations that is keeping the front buffer drawing from working well on Solaris. Any ideas on how to make my Solaris box better? I have downloaded the 1.5 OpenGL for my Solaris box but is there a way to upgrade the video drivers some more? Thanks again!