Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (595) Games in Android Showcase (168) games submitted by our members Games in WIP (646) 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 4899 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.

 deepthought (49 views) 2015-06-30 15:39:44 deepthought (56 views) 2015-06-30 15:39:09 deepthought (65 views) 2015-06-30 15:36:52 Za\'Anzabar (43 views) 2015-06-29 05:44:54 TritonDreyja (49 views) 2015-06-24 17:10:40 CopyableCougar4 (49 views) 2015-06-23 00:34:45 BurntPizza (58 views) 2015-06-21 20:36:46 cookiecompiler (98 views) 2015-06-11 15:42:53 cookiecompiler (58 views) 2015-06-11 15:41:14 NegativeZero (82 views) 2015-06-11 09:49:18
 princec 31x wessles 23x orangepascal 21x CopyableCougar4 19x BurntPizza 18x EgonOlsen 17x opiop65 17x ags1 15x nsigma 15x Riven 13x KaiHH 12x Jesse 11x SauronWatchesYou 11x theagentd 11x KevinWorkman 11x sunburn 11x
 How Do I Expand My Game?by bashfrog2015-06-14 11:34:43List of Learning Resources2015-05-31 05:37:30Intersection Methodsby Roquen2015-05-29 08:19:33List of Learning Resources2015-05-05 10:20:32How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14
 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