PDA

View Full Version : where did they get the coordinates



grimoire
05-02-2004, 05:44 PM
I am still on the NeHe tutorials and I understand everything except for where they got the coordinates from.
void Display(void){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-1.5,0.0,-6.0);
glBegin(GL_POLYGON);
glVertex3f(0.0,1.0,0.0);
glVertex3f(1.0,-1.0,0.0);
glVertex3f(-1.0,-1.0,0.0);
glEnd();
glTranslatef(3.0,0.0,0.0);
glBegin(GL_QUADS);
glVertex3f(-1.0,1.0,0.0);
glVertex3f(1.0,1.0,0.0);
glVertex3f(1.0,-1.0,0.0);
glVertex3f(-1.0,-1.0,0.0);
glEnd();
glutSwapBuffers();
}and they created the coordinate system with this
gluPerspective(45.0,(GLfloat)Width/(GLfloat)Height,0.1,100.0);How did they know to translate and how did they get those numbers??

dorbie
05-03-2004, 12:18 PM
The eye starts at the origin looking down the -z axis. If you don't place a transform on the modelview matrix any numbers around the z axis in the direction of viewing will produce visible results (face culling and other state not withstanding). If you have polygons with vertices using other numbers you will need to place a transformation on the modelview (e.g. a translate) to see them.