Hooray got glReadPixel to work in Visual Basic

Whew. I spent two days working on glReadPixel for Visual Basic. I will post it at Nehe’s website for tutorial. I included RGBA value, Z coordinate distance to objects in my tutorial project.

The problem I have is that the RGBA value show unstable in my text boxes. I think glReadPixel picked up screen color instead of object’s actual color. Anyone mind to help me with that?

Waldoo

glReadPixel reads the pixel color from the framebuffer. It has nothing to do with the object colour

OIC… What code that would get object’s colour similiar to glReadPixel function?

Waldoo

Nothing I know of. However, when you need to pick a color, you can render your scene to the backbuffer again with flat shading and texturing and lighting disabled, and then you can pick your ‘object color’ with glReadPixels. You don’t have to make the result of this rendering visible. Just don’t swap buffers.

I checked in my code there isnt any shadow or light function in it. It is my guess that computer was trying to determine the color between 0-255 for variable as byte output from glcolor function with 0 to 1 as integar. Is there a way to limit glcolor from making too many colors? I did 1/255 on glcolor for honest color as byte it only work on some colors. Any suggestion to elimate glcolor’s confusion color output?

Waldoo

[This message has been edited by waldoo (edited 03-05-2002).]

I put texture map on an object and I got stable RGB value result from glReadpixel. I think it was faulty of glColor that gave me unstable value before. I wish I knew what OpenGL developer did with glColor function. I think its something that need to bring their attention to this bug.

Waldoo