glDrawPixels problem

In my application I like to draw a line, which is following the mouse pointer. That’s working fine but as my scene is using several 1000 objects it is getting rather slow.

So I tried the following:

  • allocate a buffer
  • glReadPixels

when the mouse moved:

  • glDrawPixels
  • drawLine

The pixels are drawn but the line doesn’t appear.
If the line with glDrawPixels is deleted, it’s working again.

Forgot to mention, that I’m using double buffering. Swapped buffers afterwards, tried inbetween, but no effect.

Tried glFlush and glFinish after glDrawPixels.

Then I moved the Rasterpos for the insertion a bit and realized, that glDrawPixels take effect, when the whole window is repainted (it’s a MS-Win-Application - so the WM_PAINT-event). But glDrawPixels is setting the pixels on top of all others, although my line-functions are invoked later.

I’m thankful for any hint or comment.

Try glDepthMask(0) before glDrawPixels(). Restore with glDepthMask(1).

yes - that’s it. Now it’s working as it should for me. Thanks …

I put the glDepthMask(1) call after the linedraw, as the line sometimes got obscured by the image.