This topic is now archived and is closed to further replies.


Question about glTranslate and plotting points in general.

Recommended Posts

glTrnaslate will put me at a certain place in 3d space... ex: glTranslate(-1.5, 0.0f, -6.0f); now lets say i want to draw a triangle... ex: 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(); Will each line of creating the triangle vertex''s be in relation to my original starting point pointed out by glTranslate(-1.5, 0.0f, -6.0f); or will the vertex points be in relation to the last vertex plotted while drawing the triangle? Sorry if this is not clear what i am asking, if not let me know and i will change the wording. If anyone can help me i would appreciate it.

Share this post

Link to post
Share on other sites
in case you don''t already know glTranslatef takes the arguments for first the x''s positioning, followed by the y''s positioning and finally the z''s positioning (glTranslatef(x, y, z), if you will). By putting in the -1.5f, you move over the positioning of where your drawing all of your x''s over 1.5 units.

so technically putting in...

glTranslatef(0.0f, 0.0f, -6.0f);
glVertex3f(( 0.0f - 1.5f), 1.0f, 0.0f);
glVertex3f((-1.0f - 1.5f), -1.0f, 0.0f);
glVertex3f(( 1.0f - 1.5f), -1.0f, 0.0f);

creates the same effect as what you previously had (by the way I left the mathematical operations to show that we were taking 1.5 from all of the coordinates). I feel I must add that I am also learning OpenGL, so if anyone sees any errors in this post feel free to correct me.

Share this post

Link to post
Share on other sites