Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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  
  Am I blind? gl.rotate missing?  (Read 2560 times)
0 Members and 1 Guest are viewing this topic.
Offline Captain-Goatse

Junior Duke




I suck at teh 2D. XBOX IS BIG LOL!111


« Posted 2003-04-13 14:33:21 »

I can't find gl.rotate to work with my quaternions? Is it is somewhere in there or do I have to do it manually?

Edit: Argh let me die now, in the newer versions it was split up between rotatef and rotated? Both do what rotate did?
Offline Captain-Goatse

Junior Duke




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #1 - Posted 2003-04-13 14:43:55 »

Umm no... what kind of trickery is this!???
Offline javatypo

Junior Duke





« Reply #2 - Posted 2003-04-13 19:52:25 »

gl.rotatef(float f1,float f2,float f3,float f4);

i use f1 - f4 because i dont know what they represent, but rather what they seem to do..

which would imply that i am still waiting for documentation when the real version comes out (lwjgl 1.0)

hope i actually helped with lwjgl..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline javatypo

Junior Duke





« Reply #3 - Posted 2003-04-13 20:06:28 »

ops, didnt read your post entirely.. i think the different methods just depend on what level of accuracy u want..

but i dont really know.

and a question about this method. what do each of these parameters do?

gl.rotatef(xscale, yscale, zscale, Huh);

please correct me if i am wrong.. thanks.. (sorry for a bit off topic)
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #4 - Posted 2003-04-13 21:15:07 »

Quote
in the newer versions it was split up between rotatef and rotated? Both do what rotate did?

No, it's always been split up like that - at least since OpenGL 1.0 anyway.  I don't know about IRIS GL as I never used it.

Quote
which would imply that i am still waiting for documentation when the real version comes out (lwjgl 1.0)

Well, "rotate" is just pure OpenGL, so I wouldn't wait for LWJGL docs for that kind of thing.  Just find a downloadable copy of the OpenGL Redbook (up to version 1.2 I think is now freely available), or pull the OpenGL specs from http://www.opengl.org/developers/documentation/specs.html.

Just to save you some time, the method description is:

1  
2  
3  
glRotate[fd](TYPE angle, TYPE x, TYPE y, TYPE z);

Multiplies the current matrix by a matrix that rotates an object (or the local coordinate system) in a counterclockwise direction about the ray from the origin through the point (x, y, z).  The angle parameter specifies the angle of rotation in degrees.

So the double version is just for added precision.  If you don't need it just stick with floats.  The "usual" way of using this method is just to use 1.0f on the axis you want to rotate around, so a rotation of 45 degrees about the Z-axis would be "gl.rotatef(45.0f, 0.0f, 0.0f, 1.0f)".

Hope that makes things a bit clearer!

Hellomynameis Charlie Dobbie.
Offline princec

JGO Kernel


Medals: 407
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-04-13 21:27:44 »

There's a pretty reasonable chance there won't be any added precision in any consumer-class hardware as well seeing as all their internal data is held as 4-byte floats.

Cas Smiley

Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #6 - Posted 2003-04-13 21:55:30 »

True, you should write an article on that sort of thing too! Grin

It's all very well having an API that allows you to do loads of different things, but there are some things you either shouldn't do or shouldn't bother doing, like transforming your viewing matrix or assuming your target platform has an AUX buffer or using unnecessary precision.  That'd be useful.

Hellomynameis Charlie Dobbie.
Offline javatypo

Junior Duke





« Reply #7 - Posted 2003-04-13 22:58:51 »

gl.rotatef(45.0f,0.0f,0.0f,1.0f);

rotates on the Z axis.. then how do u rotate on the X axis?
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #8 - Posted 2003-04-14 00:30:12 »

gl.rotatef(angle,1.0f,0.0f,0.0f) ;

Hellomynameis Charlie Dobbie.
Offline javatypo

Junior Duke





« Reply #9 - Posted 2003-04-14 17:48:43 »

okay.. so the first argument is the the angle, and then for the axis u want to rotate u put to 1.0?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zparticle

Senior Duke




Thick As A Brick


« Reply #10 - Posted 2003-04-14 18:22:21 »

http://java-game-lib.sourceforge.net/documents/javadoc/org/lwjgl/opengl/CoreGL.html

JavaDocs are wonderful. Smiley

gl.rotate(float angle,float x,float y,float z)

Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #11 - Posted 2003-04-14 19:29:38 »

JavaDocs are wonderful.

Hah! Not half as 'leet as my Cygwin console!


bash-2.05b$ man glRotate

NAME
      glRotated, glRotatef - multiply the current matrix by a rotation matrix

C SPECIFICATION
      void glRotated( GLdouble angle,
                      GLdouble x,
                      GLdouble y,
                      GLdouble z )
      void glRotatef( GLfloat angle,
                      GLfloat x,
                      GLfloat y,
                      GLfloat z )

PARAMETERS
      angle  Specifies the angle of rotation, in degrees.

      x, y, z
             Specify the x, y, and z coordinates of a vector, respectively.

DESCRIPTION
      glRotate produces  a  rotation  of  angle  degrees  around  the  vector
      (x,y,z).   The  current  matrix  (see  glMatrixMode) is multiplied by a
      rotation matrix with the product replacing the current  matrix,  as  if
      glMultMatrix were called with the following matrix as its argument:

                        x2(1-c)+c  xy(1-c)-zs xz(1-c)+ys 0

                        yx(1-c)+zs y2(1-c)+c  yz(1-c)-xs 0

                       (                                  )

                        xz(1-c)-ys yz(1-c)+xs z2(1-c)+c  0

                            0          0          0      1

      Where  c=cos(angle),  s=sin(angle),  and  ||(x,y,z)||=1 (if not, the GL
      will normalize this vector).

      If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects
      drawn  after  glRotate  is  called  are  rotated.  Use glPushMatrix and
      glPopMatrix to save and restore the unrotated coordinate system.

NOTES
      This rotation follows the right-hand rule, so  if  the  vector  (x,y,z)
      points toward the user, the rotation will be counterclockwise.

ERRORS
      GL_INVALID_OPERATION  is  generated if glRotate is executed between the
      execution of glBegin and the corresponding execution of glEnd.

ASSOCIATED GETS
      glGet with argument GL_MATRIX_MODE
      glGet with argument GL_COLOR_MATRIX
      glGet with argument GL_MODELVIEW_MATRIX
      glGet with argument GL_PROJECTION_MATRIX
      glGet with argument GL_TEXTURE_MATRIX

SEE ALSO
      glMatrixMode(3G),  glMultMatrix(3G),   glPushMatrix(3G),   glScale(3G),
      glTranslate(3G)


Like it? Go get it!. Just remember to install the GL stuff.  Grin

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Captain-Goatse

Junior Duke




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #12 - Posted 2003-04-15 08:51:39 »

I'll just used multMatrix anyway, since eventually I had to do it that way. Byt the way, princec? Want that quaternion class(I mean the whole thing)? It is done in the same way as lwgjl Vector4f, except that it is quaternion. I have the most used primitive methods. in there. I think it is quite understandable and easy to use. I'll look through my math books tonight and figure out some possible optimizations.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!