Am I blind? gl.rotate missing?

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?

Umm no… what kind of trickery is this???

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…

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, ???);

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

[quote]in the newer versions it was split up between rotatef and rotated? Both do what rotate did?
[/quote]
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)
[/quote]
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:

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!

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 :slight_smile:

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

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.

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

rotates on the Z axis… then how do u rotate on the X axis?

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

okay… so the first argument is the the angle, and then for the axis u want to rotate u put to 1.0?

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

JavaDocs are wonderful. :slight_smile:

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

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. ;D

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.