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:

Qt Code:
  1. if( mDrawBoxZoom == true )
  2. {
  3. setAutoBufferSwap( false );
  4. qglColor( mPlotBoxZoomColor );
  5. glDrawBuffer( GL_FRONT );
  6. glLogicOp( GL_XOR );
  7. glEnable( GL_COLOR_LOGIC_OP );
  8. glEnable( GL_BLEND );
  9. glBlendEquationEXT( GL_COLOR_LOGIC_OP );
  10. glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
  11. glLineWidth( 2.0 );
  12. // Draw back over the previously drawn box
  13. glBegin( GL_LINE_LOOP );
  14. glVertex3d( mBeginDrawBox[0], mBeginDrawBox[1], 0.0 );
  15. glVertex3d( mBeginDrawBox[0], mOldEndDrawBox[1], 0.0 );
  16. glVertex3d( mOldEndDrawBox[0], mOldEndDrawBox[1], 0.0 );
  17. glVertex3d( mOldEndDrawBox[0], mBeginDrawBox[1], 0.0 );
  18. glEnd( );
  19. // Draw the new box with the current mouse position
  20. glBegin( GL_LINE_LOOP );
  21. glVertex3d( mBeginDrawBox[0], mBeginDrawBox[1], 0.0 );
  22. glVertex3d( mBeginDrawBox[0], mEndDrawBox[1], 0.0 );
  23. glVertex3d( mEndDrawBox[0], mEndDrawBox[1], 0.0 );
  24. glVertex3d( mEndDrawBox[0], mBeginDrawBox[1], 0.0 );
  25. glEnd( );
  26. glFlush( );
  27. glLineWidth( 1.0 );
  28. glDisable( GL_COLOR_LOGIC_OP );
  29. glDisable( GL_BLEND );
  30. glDrawBuffer( GL_BACK );
  31. setAutoBufferSwapping( true );
  32. }
To copy to clipboard, switch view to plain text mode 

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.