Archived

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

GekkoCube

GLFloat vs float and others stuff like that.

Recommended Posts

what''s the difference between GLFloat and float? i noticed that with direct3D, i must rotate an object and then translate it...if I wanted the object to spin at location (100,0,50)...for example. But in opengl, i noticed that i must translate and then rotate to get the same effect. why is this? (unless i am doing something wrong or just simply mistaken). ~ I am a DirectX to OpenGL convert! ~

Share this post


Link to post
Share on other sites
quote:

unless i am doing something wrong or just simply mistaken


Just following from this sentence. I should have used some question marks ??? to indicate that I don''t have an answer for you and didn''t intend any ill by the comment.

Share this post


Link to post
Share on other sites
OpenGL and Direct3D use different matricies for transformations Direct3D uses Coullem-Major (or is it row-major, I can never remember) matricies for transformations which allows for you to transform in "foward" order while in OpenGL you must transform "backwards"

Share this post


Link to post
Share on other sites
row and column major has nothing to do with that. Row major and column major only specifies the way the matrices are layed out in memory.


The real reason is Opengl using a matrix stack operations. So when you call
glTranslatef, it pushes a translate matrix on the stack. If you call glRotatef, if pushes a rotation matrix on the stack.

When the times come to transform the object, the matrices are removed from the stack and multiplied together. ( They are actually multiplied immediatly, put it is simply to understand).

Example :

if you do

glTranslatef
glRotatef

you stack will look like this :

top = rotate
translate

When you render, is pushes rotate of the stack. then pushes translate out of the stack and multiplies so

translate * rotate

But direct3d does not use a stack, it multiplies the matrices has you pass them. So if you need to call for a rotation first and then a translation to do the same effect has the above opengl calls.



Share this post


Link to post
Share on other sites
mathmatical standard is translation/rotation/scaling etc will occur at the current origin
thus if the origin is currently at (0,0,0) + u wanna rotate aroun (50,100,0) u must first translate to (50,100,0) + then apply the rotation

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites