1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
glPushMatrix();
glLoadIdentity();
// Rotate before Translate (otherwise wierd things happen)
glRotated(rotz, 0.0, 0.0, 1.0);
glRotated(roty, 0.0, 1.0, 0.0);
glRotated(rotx, 1.0, 0.0 ,0.0);
glTranslated(xpos, ypos, zpos);
glBegin(GL_QUADS);
glVertex4d(0.0, 0.0, 0.0, 1.0); // Start from Origin
glVertex4d(0.0, yLen, 0.0, 1.0);
glVertex4d(xLen, yLen, 0.0, 1.0);
glVertex4d(xLen, 0.0, 0.0, 1.0);
glVertex4d(0.0, 0.0, 0.0, 1.0); // Start new face
glVertex4d(0.0, 0.0, zLen, 1.0);
glVertex4d(0.0, yLen, zLen, 1.0);
glVertex4d(0.0, yLen, 0.0, 1.0);
//etc...
glEnd();
glPopMatrix();
|