GLFloat vs float and others stuff like that.

Started by
5 comments, last by GekkoCube 22 years, 2 months ago
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! ~
Advertisement
From gl.h:

typedef float GLfloat;

You must be doing something wrong
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
what do you mean by "you must be doing somethign wrong?"
are you being sarcastic?

~ I am a DirectX to OpenGL convert! ~
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.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
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"
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.



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

This topic is closed to new replies.

Advertisement