View Full Version : gltranslate

02-28-2006, 07:25 AM
Could someone please clarify how OpenGL supports the gltranslate etc commands by explaining the following:

My program creates arcs on say the XY_PLANE at constant Z coordinates based on a centre position of X0 Y0 Z0 and then translates the centre point to a given X/Y/Z point.
The program structure is as follows, please ignore syntax:

call arc(10,0,0)
call arc(10,0,0)

Public sub arc(x,y,z)
gltranslate x, y, z
glBegin GL_LINES
"arc definition as lines at centre 0,0,0 and fixed radius"
End sub

I would expect the two arcs to be drawn in the same place at X10,Y0,Z0 but they appear to be at X10,Y0,Z0 and X20,Y0,Z0

I had expected the matrix to take the transformation as absolute values, this does not appear to be the case. Thanks for any assistance.

02-28-2006, 08:54 AM
you have to enclose your code in glPushMatrix()(at the begining of the function) and glPopMatrix()(at the end of the function).