#### Archived

This topic is now archived and is closed to further replies.

# What the hell is going on here?!?!?!?!?!

This topic is 6061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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"

##### Share on other sites
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:

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.

##### Share on other sites
lol i forgot to edit the comments, pay no attention to them

GL_TRIANGLE_STRIP ?

"Those who serve no purpose, have no purpose"

##### Share on other sites
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"

##### Share on other sites
quote:

GL_TRIANGLE_STRIP ?

Time for some nice ASCII art

  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

• 17
• 10
• 19
• 14
• 19