What the hell is going on here?!?!?!?!?!
now i was trying to make a simple blue sqaure bu i get this totally weird thing
here is a code fragment
glRotatef(rquad,0.0f,0.0f,0.0f); // Rotate The First Triangle On The Y axis
glBegin(GL_QUADS); // Drawing Using Quads
glColor3f( 0.0f, 0.0f, 1.0f); // This Quad Will Be Blue
glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left Point
glVertex3f( 0.5f, 1.0f, 0.0f); // Top Right Point
glVertex3f(-0.5f,-1.0f, 0.0f); // Bottom Left Point
glVertex3f( 0.5f,-1.0f, 0.0f); // Bottom Right Point
glEnd(); // Finished Drawing The Quad
rquad-=0.5f; // Decrease The Rotation Variable For The Quad
instead of showing a sqaure it shows something like a K and it goes back and forth and turns 180 degrees when it hits the horizon
can u plz tell me what the hell is going on
"Those who serve no purpose, have no purpose"
quote:
glRotatef(rquad,0.0f,0.0f,0.0f); // Rotate The First Triangle On The Y axis
That should be:
glRotatef(rquad,0.0f,1.0f,0.0f);
If you want rotation about the Y-axis.
quote:
glBegin(GL_QUADS); // Drawing Using Quads
glColor3f( 0.0f, 0.0f, 1.0f); // This Quad Will Be Blue
glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left Point
glVertex3f( 0.5f, 1.0f, 0.0f); // Top Right Point
glVertex3f(-0.5f,-1.0f, 0.0f); // Bottom Left Point
glVertex3f( 0.5f,-1.0f, 0.0f); // Bottom Right Point
glEnd(); // Finished Drawing The Quad
Try this:
glBegin(GL_QUADS); // Drawing Using Quads glColor3f( 0.0f, 0.0f, 1.0f); // This Quad Will Be Blue glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left Point glVertex3f( 0.5f, 1.0f, 0.0f); // Top Right Point glVertex3f( 0.5f,-1.0f, 0.0f); // Bottom Right Point glVertex3f(-0.5f,-1.0f, 0.0f); // Bottom Left PointglEnd(); // Finished Drawing The Quad
The vertex-order you had looked more like a GL_TRIANGLE_STRIP than a GL_QUAD.
lol i forgot to edit the comments, pay no attention to them
GL_TRIANGLE_STRIP ?
"Those who serve no purpose, have no purpose"
GL_TRIANGLE_STRIP ?
"Those who serve no purpose, have no purpose"
dope u were right about the order
i changed it to counter clockwise
but i still dont get why the quad goes into the horizon and comes back
"Those who serve no purpose, have no purpose"
i changed it to counter clockwise
but i still dont get why the quad goes into the horizon and comes back
"Those who serve no purpose, have no purpose"
quote:
Original post by SonShadowCat
GL_TRIANGLE_STRIP ?
Time for some nice ASCII art
Vertex order for GL_QUADS:
1 2 +---------+ | | | | | | | | +---------+ 4 3
Vertex order for GL_TRIANGLE_STRIP:
1 3 5 7 +----+----+----+ | /| /| /| | / | / | / | | / | / | / | |/ |/ |/ | +----+----+----+ 2 4 6 8
The first 3 vertices form a triangle, and each following vertex forms a triangle with the two most recently specified vertices.
quote:
but i still dont get why the quad goes into the horizon and comes back
Are you doing any translations? If so, then make sure that the translations and rotations come in the correct order (I can never remember if it's translate first, then rotate, or the other way around)
Edited by - Dactylos on October 16, 2001 4:48:53 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement