Ok I got the rotation kind of working but now I need my car to detect the box and when it does the box should change colors....

The thing is I just don't know why they make it so hard

why not just say if (drawCar == drawobstacles)
drawobstacles glColor3f(1.0, 1.0, 0.0);

drawcar and drawobstacles are functions I made and apparently I can't use functions in if statements so I have to find the coordinates of x and y of the box.. but how do I do that!

Here is my code for the obstacles (I just put two squares for now)

void drawobstacles(float radius,float x,float y)
{


glBegin(GL_POLYGON);
glColor3f(0.0, 1.0, 0.0);
//specify the vertices (points in 3D space) of the shape - note that these are 2D points

glVertex2f( -24.0, 24.0);
glVertex2f( -18.0, 24.0);
glVertex2f( -18.0, 18.0);
glVertex2f( -24.0, 18.0);
glEnd();


glBegin(GL_POLYGON);
glColor3f(0.0, 1.0, 0.0);
//specify the vertices (points in 3D space) of the shape - note that these are 2D points

glVertex2f( -6.0, 6.0);
glVertex2f( 0.0, 6.0);
glVertex2f( 0.0, 0.0);
glVertex2f( -6.0, 0.0);
glEnd();


glFlush(); /* execute drawing commands in buffer */
}

here is my code for the car

void drawCar(float radius,float x,float y)
{


glRotatef(angle, 0.0, 0.0, 1.0 );

if (drawCarx > border||drawCary > border)
resetCar ();


glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
//specify the vertices (points in 3D space) of the shape - note that these are 2D points

glVertex2f( 4.0, 2.0);
glVertex2f( 4.0, -2.0);
glVertex2f( -4.0, -2.0);
glVertex2f( -4.0, 2.0);
glEnd();


glBegin(GL_POLYGON); // wheel, south east corner
glColor3f(1, 1, 1);

glVertex2f( 4.0,-2.0);
glVertex2f( 5.0, -2.0);
glVertex2f( 5.0, -2.5);
glVertex2f( 4.0, - 2.5);
glEnd();


glBegin(GL_POLYGON); // wheel, south west corner
glColor3f(1, 1, 1);

glVertex2f( 4.0 -7,-2.0);
glVertex2f( 5.0-7, -2.0);
glVertex2f( 5.0-7, -2.5);
glVertex2f( 4.0-7, - 2.5);
glEnd();

glBegin(GL_POLYGON); // wheel, north west corner
glColor3f(1, 1, 1);

glVertex2f( 4.0 -7,-2.0 +4.5);
glVertex2f( 5.0-7, -2.0+4.5);
glVertex2f( 5.0-7, -2.5+4.5);
glVertex2f( 4.0-7, - 2.5+4.5);
glEnd();


glBegin(GL_POLYGON); // wheel, north east corner
glColor3f(1, 1, 1);

glVertex2f( 4.0,-2.0+4.5);
glVertex2f( 5.0, -2.0+4.5);
glVertex2f( 5.0, -2.5+4.5);
glVertex2f( 4.0, - 2.5+4.5);
glEnd();


glBegin(GL_POLYGON);
glColor3f(0.7, 0.7, 0.7);

glVertex2f( 6.0, 2.0);
glVertex2f( 6.0, -2.0);
glVertex2f( -2.0, -2.0);
glVertex2f( -2.0, 2.0);
glEnd();



glBegin(GL_POLYGON);
glColor3f(1, 0, 0); //top triangle window

glVertex2f( 0.0 - 1, 2.0);
glVertex2f( 3.0 -1, 0.0);
glVertex2f( 0.0 -1, -2.0);
glEnd();


glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);

glVertex2f( 2.0 +5, 2.0);
glVertex2f( -2.0 +5, 2.0);
glVertex2f( -2.0 +5, -2.0);
glVertex2f( 2.0 +5, -2.0);
glEnd();


glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 0.0); // left Light

glVertex2f( 6.7+0.3, 1.2);
glVertex2f( 6.3+0.3 ,1.2);
glVertex2f( 6.3+0.3, 0.8);
glVertex2f( 6.7+0.3, 0.8);
glEnd();


glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 0.0); // right Light

glVertex2f( 6.7+0.3, 1.2 -2);
glVertex2f( 6.3+0.3, 1.2-2);
glVertex2f( 6.3+0.3, 0.8-2);
glVertex2f( 6.7+0.3, 0.8-2);
glEnd();


glBegin(GL_POLYGON); // Front hood
glColor3f(0.7, 0.7, 0.7);

glVertex2f( 3 +2.5, 1.2);
glVertex2f( 1+2.5, 1);
glVertex2f( 1+2.5, -1);
glVertex2f( 3+2.5, -1.2);
glEnd();


glFlush(); /* execute drawing commands in buffer */
}


and my display

void display(void)
{



glClear (GL_COLOR_BUFFER_BIT); /* clear window */


glLoadIdentity(); // so it doesn't multiply

drawBorder(5,0,0);
drawstartfinish(5,0,0);
drawobstacles(5,0,0);

glLoadIdentity(); // so it doesn't multiply
glTranslatef(drawCarx-25,drawCary-26,0); //


drawCar(5,0,0); //displays the car function


glFlush(); /* execute drawing commands in buffer */


}

How can I make collision detection between obstacles (box) and car? ):

Also

How do I put text on my screen, on the top right I want to put "score" + points - this would be a float or integer variable I guess but I just can;t seem to find the code to display text and numbers.... why do they make things so complicated

why not just put

write-text "score" + score.

I really need help asap as my deadline is closing in ):

thank you and sorry for any inconvenience