Java-Gaming.org Hi !
 Featured games (88) games approved by the League of Dukes Games in Showcase (681) Games in Android Showcase (196) games submitted by our members Games in WIP (744) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 gl.glRotatef(this.rotate, 0f, 0f, -12.0f);  (Read 5841 times) 0 Members and 1 Guest are viewing this topic.
Ru5tyNZ

Senior Newbie

 « Posted 2008-04-22 00:04:31 »

gl.glRotatef(this.rotate, 0.0f, 0.0f, -12.0f);
Just been trying to get my head around how this method works. After looking at the api I manage to get that the first argument is the angle and the other three are the coordinates of the point you are rotating around? Yeah just been trying to us it and my models have been doing all kinds of cool things just not what i want.

So could someone please please please explain how the glRotate method works? I know this must be a noob question but I’m only just getting my head into the thousands of jogl methods and fields and your help would be greatly appreciated.

Enlighten me!

Cheers,
James
Ru5tyNZ

Senior Newbie

 « Reply #1 - Posted 2008-04-22 00:13:59 »

Think seeing this bit of code may of helped... maybe

gl.glRotatef(xrot,1.0f,0.0f,0.0f);
gl.glRotatef(yrot,0.0f,1.0f,0.0f);
gl.glRotatef(zrot,0.0f,0.0f,1.0f);
Bonbon-Chan

JGO Coder

Medals: 12

 « Reply #2 - Posted 2008-04-22 06:49:38 »

the first argument is the angle and the other three are the coordinates of the point you are rotating around?

- The first argument is the angle of the rotation (in degrees)
- The others arguments are NOT the point you are rotating around. You always rotate around origine (0.0 , 0.0, 0.0). If you want to rotate around another point, you should use a translation with it.
- The others arguments are a vector that show how the angle is apply. The rotation is in a perpendicular plan to the vector. And when you look at the vector from the end to the begining, the angle is counter clock wise.

So like Ru5tyNZ said :

gl.glRotatef(xrot,1.0f,0.0f,0.0f); is a rotation around the X axis
gl.glRotatef(yrot,0.0f,1.0f,0.0f);is a rotation around the Y axis
gl.glRotatef(zrot,0.0f,0.0f,1.0f); is a rotation around the Z axis
Ru5tyNZ

Senior Newbie

 « Reply #3 - Posted 2008-04-22 07:04:34 »

- The first argument is the angle of the rotation (in degrees)
- The others arguments are NOT the point you are rotating around. You always rotate around origine (0.0 , 0.0, 0.0). If you want to rotate around another point, you should use a translation with it.
- The others arguments are a vector that show how the angle is apply. The rotation is in a perpendicular plan to the vector. And when you look at the vector from the end to the begining, the angle is counter clock wise.

So like Ru5tyNZ said :

gl.glRotatef(xrot,1.0f,0.0f,0.0f); is a rotation around the X axis
gl.glRotatef(yrot,0.0f,1.0f,0.0f);is a rotation around the Y axis
gl.glRotatef(zrot,0.0f,0.0f,1.0f); is a rotation around the Z axis

Cheers that clears it up perfectly.
Pages: [1]
 ignore  |  Print

You cannot reply to this message, because it is very, very old.

 CopyableCougar4 (20 views) 2016-06-25 16:56:52 Hydroque (54 views) 2016-06-22 02:17:53 SwampChicken (56 views) 2016-06-20 13:22:57 SwampChicken (56 views) 2016-06-20 13:22:49 SwampChicken (52 views) 2016-06-20 13:22:26 Hydroque (94 views) 2016-06-15 08:22:50 Hydroque (85 views) 2016-06-13 06:40:55 DarkCart (203 views) 2016-05-29 02:30:33 Hydroque (172 views) 2016-05-26 14:45:46 Mac70 (172 views) 2016-05-24 21:16:33
 Spasi 46x theagentd 43x NegativeZero 39x KaiHH 30x princec 26x LiquidNitrogen 23x kingroka123 15x ags1 15x ra4king 12x CoDi^R 11x Opiop 10x purenickery 10x Hydroque 9x Archive 8x h.pernpeintner 8x czak 7x
 Making a Dynamic Plugin Systemby Hydroque2016-06-25 00:13:25Java Data structures2016-06-13 21:22:09Java Data structures2016-06-13 21:20:42FPS Camera Tutorialby Hydroque2016-05-22 05:40:58Website offering 3D Models specifically for games for freeby vusman2016-05-18 17:23:09Website offering 3D Models specifically for games for freeby vusman2016-05-09 08:50:56Website offering 3D Models specifically for games for freeby vusman2016-05-06 11:10:21Website offering 3D Models specifically for games for freeby vusman2016-04-29 12:56:17
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org