PDA

View Full Version : Strange(?) behavior of glDrawPixels



passalis
06-27-2003, 06:21 AM
Hi,
I am using in my application glDrawPixels to write on the frame buffer and I noticed some strange things:

1) The result of the glDrawPixels seemed completely random and undefined. After a while I found that the reason for this was that I had GL_TEXTURE_2D enabled. (when I disabled it worked fine) Is this logical? I mean, why should texturing affect a raster operation? I did not find it documented anywhere. (I noticed that on my work's PC which has a Quadro XGL900)

2) In my laptop (with the gforce 460go) I was using a RGBA buffer and I rendered on it a RGB bitmap. It was being rendered OK but when I resized the window sometimes it caused a nasty display driver crash. I changed the size of the bitmap from 24bit to 32bit (by adding a couple of zeros)and used GL_BGRA_EXT instead of GL_BGR_EXT and it never crached again! I am sure I hadn't any wrong dimensions for the bitmap etc, but I cannot try that again now because after every crash I must reinstall the drivers.

Has anyone encountered any similar problems, or is it just the fact that glDrawPixels doesn't like me?

Asgard
06-27-2003, 06:50 AM
1) This is normal behaviour. The pixel fragments drawn with glDrawPixels are treated as any other fragment generated by rasterization and have all the per-fragment operations applied to them. I quote from MSDN:

These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. The glDrawPixels function applies texture mapping, fog, and all the fragment operations before writing the fragments to the framebuffer.

2) Sounds like a driver bug.