Reputation: 16120
I am new to OpenGl ES. I was studying a tutorial for opengles in android where for shape movement, glTranslatef() was used. My questions is simple. First tell me whether this function is used for zooming purpose as I have seen if I am not wrong, by using -z value, the object goes into deep into screen. Second, if I have drawn a square and then used function glTranslatef(0,0,-3) and draw again a new square. Will this function call will effect the square previously drawn?
Upvotes: 1
Views: 1346
Reputation: 131
Yes the glTranslatef() function is one way to achieve the effect of zooming by changing the -z value, although the effect may not be seen if using an orthographic view. All objects drawn after the call to glTranslatef() are translated, providing the matrix mode is either GL_MODELVIEW or GL_PROJECTION. So in your example, the previously drawn square should not be effected unless you redraw it.
Upvotes: 3