glReadPixels and glDrawPixels

Hi there! I am having problems with glReadPixels and glDrawPixels functions. Can you give me a simple example for these two functions? Thanks.

This example can be used for object picking!

int mouse_x;
int mouse_y;
float old_z,new_z;

if(new_z<old_z) object_is_picked();

Thanks for the example. By the way, I am not very clear about these two functions. The first two parameters are coordinate X and Y, what are the following parameters ? What is object picking? You meant that I can drag my object (eg. sphere) from (x1, y1) to (x2, y2)? Sorry for asking so many questions. Thanks for your help.


for a description of glReadPixels.

And for picking, I suggest you get an OpenGL book or search the web.
Generally speaking, when the user clicks on an object; in some applications, you may want to know what and where is under the cursor, right? Picking is really concerning of what and where is under a NxM block of window coordinates. There are several ways to achieve this, and OpenGL provides several APIs to help to figure this out.