PDA

View Full Version : reading pixels



JamesC
11-15-2010, 11:04 PM
The program I am making involves taking the image from OpenGL, and pasting them in an OpenCV window. I'm having trouble with the parts that involve lighting.
I draw a bunch of spheres, and there's a light source, then I'm using glReadPixels like this...

char * pixels = new char[width*height*3];

glReadPixels( 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, (void*)pixels );

This is working great... except only the shaded parts of the spheres are giving me any pixel information. The lit parts gives me null values for the color.

Any ideas?

strattonbrazil
11-16-2010, 09:32 AM
What do you mean null values? "pixels" contains null values?

The shaded parts are giving you pixel information, but the lit parts give you null values? Do you mean the shadowed parts? The lit parts are considered "shaded" in OpenGL nomenclature. Can you link an image?