Advertisement

Question about placing a square

Started by September 10, 2000 02:08 AM
3 comments, last by Mike00 24 years, 2 months ago
Is there a more precise way to place a square? What I mean is, is there a way to say exactly where one corner will be instead of just doing: glVertex3f(-1.0f, 1.0f, 0.0f); I know this vertex will be 1 up. But how can I find out exactly where that is? Thanks!
opengl (and all graphical systems for that matter) have a world coordinate system (WCS). all points defined in opengl are with respect to a world coordinate system. so, if you put a GL_POINT at 0,0,0, and then a GL_POINT at the location of your vertex that you listed, you''ll see the relationship with respect to the 0,0,0 (origin). but your task is to decide on a scale. for instance, my opengl units are in meters.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
oh, but however, watch with pushmatrix and popmatrix in modelview mode, because this will totally change your understanding of the world coordinate system. there are plenty of tutorials that discuss world space, so you should read up on basic 3d graphics.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Hmm ok thanks
// start of program

glPushMatrix()
glVertex3f(-1.0f, 1.0f, 0.0f);
// this vertex is drawn at woorld coords (-1,1,0)
glPopMatrix();

glPushMatrix()
glTranslatef(10,10,0);
glVertex3f(-1.0f, 1.0f, 0.0f);
// this vertex is drawn at woorld coords (9,11,0)
glPopMatrix();

buy the red book

This topic is closed to new replies.

Advertisement