这里没有任何问题能够提供帮助。我想在 LWJGL 中围绕它的中心旋转一个精灵,一个带有纹理的四边形。
这是我的代码,目前,它围绕其他一些中心旋转。
public void draw(int x, int y, int rot) {
// 存储当前模型矩阵 glPushMatrix();
// bind to the appropriate texture for this sprite
texture.bind();
// translate to the right location and prepare to draw
glTranslatef(x, y, 0);
glRotatef(rot,0f,0f,1f);
// draw a quad textured to match the sprite
glBegin(GL_QUADS);
{
texture.bind(); // or GL11.glBind(texture.getTextureID());
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2f(100,100);
glTexCoord2f(1,0);
glVertex2f(100+texture.getTextureWidth()*2,100);
glTexCoord2f(1,1);
glVertex2f(100+texture.getTextureWidth()*2,100+texture.getTextureHeight()*2);
glTexCoord2f(0,1);
glVertex2f(100,100+texture.getTextureHeight()*2);
glEnd();
}
glEnd();
// restore the model view matrix to prevent contamination
glPopMatrix();
}