当你有坐标和原点时,有人可以快速告诉我如何在 lwjgl 中将纹理旋转 var 度吗?好吧,现在看起来像这样:x/y 是纹理的中心。
public void render(float x, float y) {
glPushMatrix();
texture.bind();
glTranslatef(x - xOrigin, y - yOrigin, 0);
//This is false. ignore it
//glRotatef(45f, 0f, 0f, 1f);
glBegin(GL_QUADS);
{
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(0, width);
glVertex2f(0, height);
glTexCoord2f(texture.getWidth(), texture.getHeight());
glVertex2f(width, height);
glTexCoord2f(texture.getWidth(), 0);
glVertex2f(width, 0);
}
glEnd();
glPopMatrix();
}
谢谢