Public Group

#### Archived

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

# 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.

## 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 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);
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 on other sites
thanks for the help

##### 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 .

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631424
• Total Posts
3000008
×