urgent: drawing squares over an image

I’m new to OpenGL
I loaded a ppm image and I can’t figure out how to draw squares over it, then update the coordinates of these shapes. when I draw them using glBegin(GLQuads) nothing is displayed. here is the code:
void display(void)
{

glClear ( GL_COLOR_BUFFER_BIT );
glRasterPos2i(0,0);
    glColor3f(1.0f, 0.7f, 0.3f);
glBegin(GL_QUADS);
glVertex3f(-0.5f, -3.5f, 3.5f);
glVertex3f(0.5f, -3.5f, 3.5f);
glVertex3f(0.5f, -3.5f, -3.5f);
glVertex3f(-0.5f, -3.5f, -3.5f);


glEnd();
glDrawPixels(n,m,GL_RGB, GL_UNSIGNED_INT, image);
  glFlush ( );

}
I just loads the image. Please help me it’s urgent

yeah, also post please what your PROJECTION and MODELVIEW matrices look like.

It’s my first time with openGL but I tried many different code without any success.
here is the projection that I’m currently having:
void handleResize(int w, int h) {
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, (float)w / (float)h, 1.0, 200.0);
}
and in the above display function:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);

does this answer your question?

With glDrawPixels, you draw into the framebuffer in a way that it would erase all previous data already written the the drawing area. Call glDrawPixels before drawing quads it would already helps.

I already tried that… doesn’t work
the only thing I can think of is the fact I’m using double buffering (I tried single buffering too) no results.
Any OpenGL experts?

First - comment out the call to DrawPixels. Then try to draw the square. I’m guessing that it doesn’t work. Your problem has nothing to do with the fact you are trying to draw a square over an image. Your problem is that you aren’t drawing the square correctly. It is not being drawn perpendicular to the line of site. It is being drawn edge-on to the line of site (which is in the -Z direction). All of your Z coordinates should be the same to draw a rectangle perpendicular to the line of site. In your example all of the Y coords are the same, but the Z coords differ. Use the Vertex commands below in place of yours and the rectangle should appear. Good luck.


       glVertex3f (-10, -5, -30);
       glVertex3f ( 10, -5, -30);
       glVertex3f ( 10,  5, -30);
       glVertex3f (-10,  5, -30);