Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Math newbie  (Read 1261 times)

Empty

  • Bay Watcher
    • View Profile
Math newbie
« on: February 24, 2009, 02:48:58 am »

I'm programming my own c++ opengl engine (Again :P) using Vertex Buffer objects.

It uses array of vertices as input mainly. Now the problem I have is that the standard opengl rotation function glrotatef doesn't work on just plain data. So I need a formula to do the rotation math myself.

These are the data I already have.
vertex.x vertex.y vertex.z rotation.x rotation.y rotation.z and possibly if needed rotationammount.
You can assume that the rotation center is always at 0,0,0
You can assume that all of these numbers are floats.

I've looked at alot of example formulas but I have been unable myself to relate those formulas to the data I have.

So is anyone able to explain or help me with it?
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Math newbie
« Reply #1 on: February 24, 2009, 04:20:12 am »

Use quaternions for rotation and watch all your problems vanish :) I know that is not really the question you asked but it will save you a lot of hassle later on.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Empty

  • Bay Watcher
    • View Profile
Re: Math newbie
« Reply #2 on: February 24, 2009, 04:58:56 am »

I don't understand those either.
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Math newbie
« Reply #3 on: February 24, 2009, 05:07:15 am »

Hmm then I'd suggest using a third party quaternion library and passing your data through that. It can handle various rotations and the like then you can handle the rendering in your engine.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd