For some reason, whenever I try to make a quad with OpenGL, it always has a clear triangle in it. I included a picture that show an example of it.
Printable View
For some reason, whenever I try to make a quad with OpenGL, it always has a clear triangle in it. I included a picture that show an example of it.
Code please.
Code:void Render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(-1.0f, -1.0f, 0.0f);
glRotatef(SpinX, 1.0, 0.0, 0.0);
glRotatef(SpinY, 0.0, 1.0, 0.0);
glRotatef(SpinZ, 0.0, 0.0, 1.0);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 2.0f, 0.0f);
glVertex3f(2.0f, 0.0f, 0.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 3.0f);
glVertex3f(0.0f, 2.0f, 3.0f);
glVertex3f(2.0f, 0.0f, 3.0f);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 3.0f);
glVertex3f(2.0f, 0.0f, 0.0f);
glVertex3f(2.0f, 0.0f, 3.0f);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
Just looking at that picture... it looks like a shadow.
it's not, because if you rotate the image you can see right through it :eek:
you are drawing the vertices in the wrong order...
edit: ascii artCode:
you are doing this...
1----2
/
/
/
3----4
you need to do this
4--3
|
|
1--2
I guess I should look up the order of vertices again :D
thx
or turn off culling