hi there. I’ve got a problem that seems to be impossible to solve, according to my searching this forum and the web and docs and tutorials ad infinitum.
This is a really simple problem to explain, but apparently really hard to read. People get confused about this issue often, as I could see when searching this forum. Please pay attention to the explanation of what I want to do:
I want to rotate a square around a FIXED AXIS.
Sorry for yelling. Nota bene, this cannot be solved simply by changing the order of glRotate and glTranslate, afaik.
So, how do I do it?
Everytime I rotate a square the “well documented way”, it rotates all the axes with it. I’m not even sure about what do I have to write to make a square rotate on its center.
I just want to move a square with the arrow keys (n.b. I want the UP key to always make the square go up) and be able to rotate this very square on its center with the Q and E keys, but without ever using sine and cosine. I can do this simply when using SDL, but I can’t rotate my graphics on SDL because it’s too slow (I’ve written a routine for it). I’m now moving to OpenGL, so if i’m forced to use sine and cosine, there’s no point on the switch. And yes, I know I could pre-compute all sines and cosines and put them in an array, I know a lot of those so-called “hackings” or “shortcuts” but the fact is I want to do this the simple way, using only openGL tools.
Please, if you know how to do this, tell me in english and C/C++, not maths. My VC++ version does not compile math.
I never had to ask a single question on any forum about anything related to programming, because I could always search and find. But I give up on this, I looked everywhere and it seems like no one has ever done a square that can me moved absolutely (up_arrow always goes up, down_arrow always goes down) and rotated on its center (its diagonals’ intersections).
If it’s not clear yet, I’m looking for something that does exactly what this “ideal function” does:
glRotateAroundThisVertex( 43 degrees, v.x, v.y, v.z );