glReadPixels - again

i finished my color selection function, and it works, but there are several problems.
one- when i just click, and read a single pixel, some times it works, and sometimes not, it depends where i click, sometimes when i click in a black spot, it still reads white.
second -when i use a big rectangle for reading, the value are not read right either.
it reads the right values for part of the pixels only.
so im asking is there any distortion the pixels goes throu while streaming throu the pipeline?
i do not use lights, nor textures.
any ideas?

I’m not sure but i think that the problem is with your GL_PACK_ALIGNMENT. Try GlPixelStorei(GL_PACK_ALIGNMENT,1);

done that already.

well, i did a lot of debugging, and the only thing i was able to find out is, that the value read from the screen are wrong.
i clearly click on a black pixel, and value that is read is (255, 255, 255).
should i disable something? maybe dithering or anything like that?
if so how do i do that?

Are you certain you are passing the correct coordinates?

well, damn, it seems like i forgot to take into acount the menus size.
that might be it, thanx for lighting my mind.

but still, when i use a rectangle for selecting, and not clicking(it now works with clicking), not all the brushes in the rectangle are selected, sometimes the rectangle is touching a lot of the black color of the brush, but the black color is not present in the pixels i read with the function. and i cant see why, becuae when i just click there, the brush is selected.
i need to send the bottom left corner, with width and height, height goes up and not down right?
[This message has been edited by okapota (edited 02-21-2001).]

[This message has been edited by okapota (edited 02-21-2001).]

I encountered a similar problem when I was implementing selection using the back buffer. In my implementation, I would know what object I was selecting by reading in the color of the pixel underneath the mouse click. As it turns out, the problem wasn’t my code, but the monitor color settings. Not sure if this applies to your case, but it’s just a thought.

Hope this helps!