PDA

View Full Version : glCopyPixel resulting in clamped values



dancvogel
11-05-2008, 11:54 AM
I am using the following code to create a magnifying glass of sorts:


glRasterPos2i(0, 0);
glBitmap(0, 0, 0, 0, mClickX - 500, mClickY, null);

glPixelZoom(2.0f, 2.0f);
glCopyPixels(mClickX - 250, mClickY, 250, 250, GL_COLOR);

However, The colors of the resulting display do not match the original. It seems as though my colors are being clamped to a very small range.

I guess I should add that the "original" is an image being drawn with glDrawPixels using GL_LUMINANCE. I am also applying a pixel map so some clamping is expected, but not even close to what the result is.

I thought maybe my problem was because I am reading from the back buffer so I added a glReadBuffer(GL_FRONT). This had an even worse effect. Not only were the colors off, the image seemed a little distorted.

Any thoughts?