Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Rotating Problem

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2012

    Rotating Problem

    I am using JOGL library.
    Basicaly I want to rodate a figure from specific center.
    shortBuf - gives back ShortBuffer,
    floatBuf -gives back FloatBuffer,

    Code :
    shortBuff = shortBuf(new short[]{0, 1, 2,3});
            floatBuffShape = floatBuf(new float[]{
                        0.5f, 0.5f, 1.0f,
                        0.5f, 0.0f, 1.0f,
                        0.0f, 0.0f, 1.0f,
                        0.0f, 0.5f, 1.0f
    gl.glVertexPointer(3, GL.GL_FLOAT, 0, floatBuffShape);
    gl.glRotatef(45f, 0.0f,0.0f, 1.0f);
    gl.glDrawElements(GL.GL_QUADS, 4, GL.GL_UNSIGNED_SHORT, 
    This code rotates rectangle 45 degrees. But I want to know where is the center point of the rotation.
    Figure rotates from 0.0f,0.0f,1.0f, or from the last vertice of rectagle - 0.0f, 0.5f, 1.0f?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Grenoble - France

    Re: Rotating Problem

    This rotates around 0,0,0 if you had no glTranslate or glMultMatrix call.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts