View Full Version : How do I get shading info?

04-08-2004, 11:50 AM
Hi all,
Beforehand I apologize if my question is too simple ...
I have a shaded 3d object (triangulated shaded mesh). I would like to get the shading information (the amount of final color that openGL calculates for each of the vertices) so I can draw marks on the surface which their size and color (different than the surface color at that point but the amount is relative to it) corresponding to the percieved color value at each point of the surface. Is it possible to do this with some function in openGL and without doing everything from scratch? Really apppreciate your comments.

04-08-2004, 02:07 PM
I think the answer is that there's no easy way to do exactly what you describe, but your overall problem should be easily solvable with a fragment shader, which should allow you to do this all in a single pass.

04-10-2004, 03:27 PM
To get the final color of a pixel on the screen
you can use:

glReadPixels( int x, int y, int width, int height, enum type, enum size, void* buffer );
where type is one of GL_RGB, GL_RGBA, ...
and size is one of GL_UNSIGNED_BYTE , ...
and buffer is large enough to hold the result.

I thought a simple question deserved a simple answer.