Sign in to follow this  
Eniak

OpenGL question about the coordinate

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
hi,

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

100
010
001

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

Greetings...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this