Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 October 2001 - 09:20 AM

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"

Sponsor:

#2 Dactylos   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 October 2001 - 09:27 AM

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 Point
glEnd(); // Finished Drawing The Quad

The vertex-order you had looked more like a GL_TRIANGLE_STRIP than a GL_QUAD.

#3 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 October 2001 - 09:30 AM

lol i forgot to edit the comments, pay no attention to them

GL_TRIANGLE_STRIP ?

"Those who serve no purpose, have no purpose"

#4 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 October 2001 - 09:33 AM

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"

#5 Dactylos   Members   -  Reputation: 122

Like
Likes
Like

Posted 16 October 2001 - 09:48 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS