Hi Pete,
This is the call I use.
b = glReadPixels(0, 0, 640, 480, GL_RGB,
GL_UNSIGNED_BYTE)
Seems to work ok for me.
If you send me an example/test of the call failing
I'll try and fix it for you.
Otherwise try out the function above, I know that one
works :) If you need it I could send you the code
where I use it.
Good luck!
--- pa...@cs... wrote: > 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
>
>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
|