Advertisement

simple ( I bet) vertex problem

Started by March 21, 2005 11:41 AM
1 comment, last by traiger 19 years, 8 months ago
why does this give me a rectangular cuboid rather than a square cube? glBegin(GL_TRIANGLES); // Start Drawing The Cube //front glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green 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); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); //top glColor3f(1.0f,0.0f,0.0f); glVertex3f(-1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 1.0f, -1.0f); //back glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glVertex3f(1.0f, -1.0f, -1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glVertex3f(1.0f, 1.0f, -1.0f); glVertex3f(1.0f, -1.0f, -1.0f); //bottom glColor3f(1.0f,0.0f,1.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glVertex3f(1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, -1.0f); glEnd();
The width of the object in the X and Y dimensions is 2.
The width of the object in the Z dimension is 1.

Change 0.0f to 1.0f for your z entries and it will be a cube of side 2.

T
Advertisement
d'oh
sorry

and thanks

This topic is closed to new replies.

Advertisement