0
코드가 올바르게 작동하지 않습니다.2d OpenGL 객체의 중심을 중심으로 회전
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
// Here I translate the camera so that the point 0/0 will be at the
//bottom left of the screen
gl.glTranslatef(CameraX, CameraY, CameraZ);
// then I draw the object to rotate like many threads here said:
gl.glPushMatrix();
// translate to the middlepoint of object
gl.glTranslatef(object.getPosX() + object.getWidth()/2, object.getPosY() + object.getHeight()/2, 0);
// rotate
gl.glRotatef(30, 0, 0, 1);
object.draw(gl);
gl.glPopMatrix();
문제는 중심 주위로 회전하지 않는다는 것입니다. 객체의 좌표를 주어진 점으로 변환 한 다음 좌표를 중심으로 회전합니다. 왜 그런가요?
고맙습니다! – user3337420
@ user3337420 니스. :) 다른 사람들이 질문에 답하는 것을 알 수 있도록 허용 된 답변으로 표시하십시오. –