[PyOpenGL-Users] glReadPixels wrong values
Brought to you by:
mcfletch
From: <pa...@cs...> - 2002-09-20 16:27:11
|
I'm trying to assign a unique color to polygons drawn in one of the OpenGL buffers in order to do picking operations. When I try to read the colors back, I get invalid results. I am setting the colors of each polygon in a loop with a command like the following: glColor3us(oid, 0, 0) (oid increases by 1 each time through the loop) Later, I try to read back the color of the polygon under the mouse cursor with a read pixels command like the following: pixel = glReadPixelsus(xWX, yWX, 1, 1, GL_RED) When I print out pixel, though, only get vales that seem to increase by 257 each time. For instance, a bunch of polygons will have values of 0, some more will have values of 257, and others will have values of 514. I have made sure that the polygons are only being flat shaded and that nothing else in the pipeline is affecting their color values. Can someone point out what I'm doing wrong? I have a feeling that it could be something with the multiplier values given in the Python OpenGL documentation, but I have a very vague idea of what they're saying. Any suggestions will be greatly apprectiated. Thanks, Pete |