LWJGL Forum

Programming => OpenGL => Topic started by: manji on September 15, 2010, 12:44:43

Title: How rotate an object
Post by: manji on September 15, 2010, 12:44:43
I am a little stuck right now. Can someone tell me how to rotate properly an object using glRotate function? Specifically I want to make a ball move, the code I am using right now is:
GL11.glTranslatef(0.0f, 0.0f, -1.0f);
GL11.glRotatef(xAngle, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(zAngle, 0.0f, 0.0f, 1.0f);

What I don't get is how can I rotate around the initial x and z axes. As soon as I rotate around x, the whole system of course is rotated and the new around the new z axis is not what I want.
Title: Re: How rotate an object
Post by: Fool Running on September 16, 2010, 12:17:00
I suggest you look at some of the tutorials here: http://nehe.gamedev.net/ They're designed to help people learn the basics of OpenGL programming and I know a lot of people (including me) have used them to get started.  ;D
Title: Re: How rotate an object
Post by: manji on September 16, 2010, 23:28:45
I had done most of these once. I understand how rotation works generally, it's just this problem that troubles me. Thnx anyway  :)
Title: Re: How rotate an object
Post by: manji on September 19, 2010, 09:06:49
I found out that this problem can be solved using a custom transformation matrix, or quaternions. I am familiar with neither, so If anyone has any useful links, please let me know.
Cheers.