Archived

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

hello_there

please help me

Recommended Posts

ok someone need to please tell me how glTranslatef() works. for example does it translate from the centre of the object or what because i need to know for my collision detection. please help!!

Share this post


Link to post
Share on other sites
Hello,

I think that it all depends on how you draw the object. If the object has translations inside of it, then the actually translation point may be different. If you are just using a primitive, then it does translate from the center.

here are some examples (in suedo code )

the first one will translate the object from the bottom left corner, because the cube is translated inside of the push/pop first, therefore making the translation point(0,0,0) the bottom left corner...

-the cubes are all 1x1x1 draw at the orgin

gl_translate X=10, Y=0, Z=0;
gl_push;
gl_translate X=0.5, Y=0.5, Z=0;
gl_draw_primitive_cube;
gl_pop;

the result of the above should have a center point of (10.5,0.5,0.0)

if you just draw a cube and translate it, then the translation point is from the center, which is (0,0,0)

gl_translate X=10, Y=0, Z=0;
gl_draw_primitive_cube;

the result of the above should have a center point of (10.0,0.0,0.0)

if i''m not making any sense, sorry but it''s late. if you understand, then i hope i''m glad i could help.

later
DarkMonkey

Share this post


Link to post
Share on other sites