First of all, sorry to make another post here so soon, I’m still new to this and I couldn’t figure this out after at least 20 minutes of Googling.
So, I’m trying to rotate a quad that isn’t at the center of a coordinate grid, like the title said.
This is what I initially tried:
public void render(){
int renderX = ot.getValue("fieldX") + (BattleRoom.FIELD_WIDTH * fieldX);
int renderY = ot.getValue("fieldY") + (BattleRoom.FIELD_HEIGHT * fieldY);
FloatBuffer matrix = BufferUtils.createFloatBuffer(16);
glGetFloat(GL_MODELVIEW_MATRIX, matrix);
glPushMatrix();
//glTranslatef(renderX,renderY,0);
//glRotatef(5, 0, 1, 0);
glTranslatef(matrix.get(15), matrix.get(14), 0);
glColor3f(1,1,1);
currentAnim.render(renderX, renderY - 40);
glPopMatrix();
}
Basically I was getting the matrix values and placing them in a float buffer, and then pushing the matrix. I would then translate the grid so that the center was at the player, and then rotate, and move it back to its original position,draw him, and pop the matrix to ensure the rotation doesn’t stick around. Unfortunately, the player is still nowhere to be found. In my debugging I noticed that if the commands that are noted out aren’t there, the player draws correctly. So at least my matrix to float buffer idea worked ^-^
Anyway, what should I do?