I have a floating cube that I want to rotate around the Y axis. The cube renders fine, the proper size, the proper coordinate, the proper texture/faces, etc.
However, the rotation is never applied. My update logic calculates a new rotation
value, between 0
and 360
.
// Set the coordinates, rotate Y axis
GL11.glTranslatef(x,y,z);
GL11.glRotatef(rotation, 0, 1f, 0);
// Each cube face rendered, etc...
GL11.glColor3f( //...
GL11.glTexCoord2f(//..
GL11.glVertex3f//..
No matter what combination I've tried, the cube never changes it's rotation.
Update Per a comment, I was using glBegin outside the glRotatef and the comment advised that I use glPush/Pop:
GL11.glPushMatrix();
GL11.glTranslatef(x,adjY,z);
GL11.glRotatef(rotation, 0f, 1f, 0);
GL11.glPopMatrix();
GL11.glBegin(GL11.GL_QUADS);
block.renderVertex(x,adjY,z,1,null,0.1f);
GL11.glEnd();