PDA

View Full Version : glReadPixels, glDrawPixels



dabeav
08-29-2002, 04:20 PM
I am attempting to create a shadow effect on my scene. I want to draw the entire scene. Save the RGBA values to an array. And save the Depth values to another array. I would then clear the buffers. And draw the scene (without textures, colors etc) from the point of view of the lights in the room and save THERE depth buffer to another array.

Then by compairing the different depth array values, i would darken certain pixels of the RBGA array. To create Shadow effects.

My question is this. What all would i need to do to draw JUST that image to the screen with glDrawPixels? Would I have to clear the buffers again? Or does glDrawPixels simply overwrite what is already in the buffer??

dorbie
08-30-2002, 07:07 AM
You should be able to disable depth testing and draw pixels. The fragments have z based on the transformed 3D position specified. You will also have to disable any stencil operations you have active... oh and texture too because drawpixels will be textured with the sample color at the last texture coordinate sent. :-) yup.