PDA

View Full Version : gltranslate



CNCapps
02-28-2006, 08: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"
glEnd
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.

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