Jump to content
  • Advertisement

Archived

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

Springer

Question about glTranslate and plotting points in general.

This topic is 5744 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

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
Advertisement
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);
glBegin(GL_TRIANGLES);
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);
glEnd();

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
No problem, no moderators have made posts of my possible mistakes yet, so hopefully there aren''t any horrible mistakes. Oh well, good luck with programming opengl .

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!