GL_QUADS draws triangle?

Hi, i’m following NeHe’s tutorials (loosely) and for some reason, the following code is drawing a 45-45-90 triangle instead of a quadrilateral (with the right angle in the upper-right hand corner). Any help is greatly appreciated.

My paint function:


   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glLoadIdentity();

   glTranslatef(-1.5f,0.0f,-6.0f);
   
   glBegin(GL_TRIANGLES);
      glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
      glVertex3f(0.0f, 1.0f, 0.0f);
      glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
      glVertex3f(-1.0f,-1.0f, 0.0f);
      glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
      glVertex3f(1.0f,-1.0f, 0.0f);
   glEnd();

   glTranslatef(3.0f,0.0f,0.0f);

   glBegin(GL_QUADS);
      glColor4f(0.5f, 0.5f, 1.0f, 1.0f);
      glVertex3f(-1.0f, 1.0f, 0.0f);
      glVertex3f(1.0f, 1.0f, 0.0f);
      glVertex3f(1.0f,-1.0f, 0.0f);
      glVertex3f(1.0f,-1.0f, 0.0f);
   glEnd();

Because the last two vertices you send are exactly the same?

Was it quicker to make this post than read the code once?

Bruce

Heh - cut and paste error. last two points of your quad are the same point.

Sorry. I read the code like 50 times and sometimes even though i’ve read it so much i can’t catch a simple error- cause I know what i mean, so my brain adds in a negative sign that isn’t there. Thought i was doing a good thing by not copying/pasting code from the tutorial and typing it all myself so i could remember all the functions :stuck_out_tongue:

Thank you.