
strange glTranslatef()....
Hi,
I''ve run into a small problem while coding with opengl.
I''m rendering a small arena at 0,0,0 and drawing all triangles with hardcoded coordinates....everything ok so far...now I''m rendering a MS3D-file (code from Nehe! 1:1).... the model is rendered at the exact position via gltranslatef....
but when I render a second model it apears at (model1 coordinates)+model2 coords..... strange.... is there something I didn''t understand with glTranslatef()??...
would it help to put the model code between a glpopmatrix()..glpushmatrix() ??
Help would be very good!!! It''s wicked
Bye NoMoRe@

Did you use glLoadIdentity() after you translated the world for drawing the first model ...
glTranslatef(x,y,z);
Render_first_model();
glLoadIdentity();
Render_second_model();
or u can do this:
glTranslatef(x,y,z);
Render_first_model();
glTranslatef(-x,-y,-z);
Render_second_model();
as glTranslate changes the axis itself and reset it to the new givin coordinats ..
i hope i did understand your post the right way ...
"If you don''''t like something, change it. If you can''''t change it, change the way you think about it!"
"He who asks is a fool for five minutes, but he who does not ask remains a fool forever."
"Imagination is more important than knowledge, for knowledge is limited while imagination embraces the entire world."(Einstein)
"The normal teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires."(William Arthur Ward)
glTranslatef(x,y,z);
Render_first_model();
glLoadIdentity();
Render_second_model();
or u can do this:
glTranslatef(x,y,z);
Render_first_model();
glTranslatef(-x,-y,-z);
Render_second_model();
as glTranslate changes the axis itself and reset it to the new givin coordinats ..
i hope i did understand your post the right way ...
"If you don''''t like something, change it. If you can''''t change it, change the way you think about it!"
"He who asks is a fool for five minutes, but he who does not ask remains a fool forever."
"Imagination is more important than knowledge, for knowledge is limited while imagination embraces the entire world."(Einstein)
"The normal teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires."(William Arthur Ward)
"If you don''t like something, change it. If you can''t change it, change the way you think about it!""He who asks is a fool for five minutes, but he who does not ask remains a fool forever.""Imagination is more important than knowledge, for knowledge is limited while imagination embraces the entire world."(Einstein)"The normal teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires."(William Arthur Ward)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement