我有几个四边形已成功显示在屏幕上,但是当我尝试设置其中一个的颜色时,它会设置所有四边形的颜色。
GL11.glColor3f(red,green,blue);
xh = getXsize() / 2;
yh = getYsize() / 2;
GL11.glPushMatrix();
GL11.glTranslated(x, y, 0);
GL11.glTranslatef(10.0f, 10.5f, -0.0f);
GL11.glRotated(rotate, 0.0f, 0.0f, -1.0f);
GL11.glTranslatef(-10.0f, -10.5f, 0.0f);
GL11.glTranslated(-x, -y, 0);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2d(x - xh, y - yh);
GL11.glVertex2d(x - xh, y + yh);
GL11.glVertex2d(x + xh, y + yh);
GL11.glVertex2d(x + xh, y - yh);
GL11.glEnd();
GL11.glPopMatrix();