PDA

View Full Version : Hooray got glReadPixel to work in Visual Basic



waldoo
03-04-2002, 06:58 PM
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

Rob The Bloke
03-04-2002, 10:05 PM
glReadPixel reads the pixel color from the framebuffer. It has nothing to do with the object colour

waldoo
03-04-2002, 10:36 PM
OIC.. What code that would get object's colour similiar to glReadPixel function?

Waldoo

zeckensack
03-04-2002, 11:16 PM
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.

waldoo
03-05-2002, 06:46 AM
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).]

waldoo
03-05-2002, 11:15 AM
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