PDA

View Full Version : Rotating Problem



JustasR
03-11-2012, 11:47 AM
I am using JOGL library.
Basicaly I want to rodate a figure from specific center.
shortBuf - gives back ShortBuffer,
floatBuf -gives back FloatBuffer,



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

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?

ZbuffeR
03-11-2012, 01:10 PM
This rotates around 0,0,0 if you had no glTranslate or glMultMatrix call.