PDA

View Full Version : glTranslate



sadhu
03-06-2002, 03:23 AM
hi,

my objects have very large coordinates.
I want to apply model transformations, i.e., translations.

so, here my question is, how can I calculate the x,y,z values, which I want to pass to glTranslate() function.
pl. give some idea.
thanks alot
sadhu

nexusone
03-06-2002, 05:27 AM
First try some examples program at http://nehe.gamedev.net, this will help you understand OpenGL.

The XYZ position depends on your viewing window.

Let's say you have a window in the shape of a cube 10 x 10 x 10.

The origin of any object before translation is 0,0,0.
Our object is 1 unit in size and to move it to the center of the window you have to translate it to 5,5,5.

Let's say your object it 100 units, to view the object in our window will will have to scale it to 1/10 its current size.
glscale(0.1,0.1,0.1)

The other way would be to make you viewing window larger.

I hope this helps.



Originally posted by sadhu:
hi,

my objects have very large coordinates.
I want to apply model transformations, i.e., translations.

so, here my question is, how can I calculate the x,y,z values, which I want to pass to glTranslate() function.
pl. give some idea.
thanks alot
sadhu