Jump to content
  • Advertisement
Sign in to follow this  

OpenGL question about the coordinate

This topic is 4384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

in this code glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); glBegin(GL_TRIANGLES); glVertex3f( 0.0f, 1.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f); glEnd(); i have some question about the coordinate in OpenGL: 1 glTranslatef(-1.5f,0.0f,-6.0f); what dose this mean? is that move a world coordinate, a view coordinate,or a view point? 2 about the triangles,is that points (0,1,0),(-1,-1,0),(1,-1,0) all in the world coordinate?

Share this post

Link to post
Share on other sites

it translates the matrix that is currently in use, you set it by setting the MatrixMode. If this is MODELVIEW it translates the modelview matrix (which is probably what you want.

LoadIdentity makes the currentMatrix the identity matrix


translate adds the values to this matrix

and it becomes

-0.5 0 0
0 1 0
0 0 -5

If the current Matrix Mode is MODELVIEW it uses this matrix to translate the coordinates of the triangle you draw next


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!