Java-Gaming.org Hi !
 Featured games (91) games approved by the League of Dukes Games in Showcase (755) Games in Android Showcase (229) games submitted by our members Games in WIP (842) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Home Help Search Login Register
Pages: [1]
 ignore  |  Print
 gl.glRotatef(this.rotate, 0f, 0f, -12.0f);  (Read 7869 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
 Games published by our own members! Check 'em out!
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

 DesertCoockie (36 views) 2018-05-13 18:23:11 nelsongames (81 views) 2018-04-24 18:15:36 nelsongames (73 views) 2018-04-24 18:14:32 ivj94 (755 views) 2018-03-24 14:47:39 ivj94 (85 views) 2018-03-24 14:46:31 ivj94 (626 views) 2018-03-24 14:43:53 Solater (101 views) 2018-03-17 05:04:08 nelsongames (182 views) 2018-03-05 17:56:34 Gornova (408 views) 2018-03-02 22:15:33 buddyBro (1068 views) 2018-02-28 16:59:18
 Java Gaming Resourcesby philfrei2017-12-05 19:38:37Java Gaming Resourcesby philfrei2017-12-05 19:37:39Java Gaming Resourcesby philfrei2017-12-05 19:36:10Java Gaming Resourcesby philfrei2017-12-05 19:33:10List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05
 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