2013-09-02 2 views
0

게임 엔진의 버그를 수정하는 데 약간의 문제가 있습니다.Android GLES 1.0에서 렌더링하는 동안 객체가 흔들립니다.

내 문제는 장면에서 카메라를 움직일 때 내 허리의 요소가 흔들리는 것을 봅니다. 손가락 슬라이드로 카메라를 움직일 때만 버그가 나타납니다. 업데이트 방법에서 위치를 변경하면 모든 것이 잘된 것처럼 보입니다. 나는이 중요한 코드라고 생각

public void onPointerMove(TouchPointer pointer, TouchPointer historicalPointer) 
{ 
    Point p = new Point(pointer.getRawTouchPoint()); 
    p.subtract(historicalPointer.getRawTouchPoint()); 
    camera.moveBy(p); 
} 

: (주요 활동에 onTouchEvent에서 호출)

public void drawScene(GL10 gl) 
{ 
    // Clear scene 
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); 
    // Move left top corner of camera to specified point 
    gl.glTranslatef(-camera.getX(), screenManager.getScreenHeight() - camera.getY(), 0f); 
    // Render all objects from the scene 
    root.renderObjects(gl); 
    // Fixed position for HUD elements 
    gl.glTranslatef(camera.getX(), -screenManager.getScreenHeight() + camera.getY(), 0.0f); 
    // Render hud to the screen 
    hud.renderObjects(gl); 
    // Get back to camera position 
    gl.glTranslatef(-camera.getX(), screenManager.getScreenHeight() - camera.getY(), 0.0f); 
    // Reset the matrix 
    gl.glLoadIdentity(); 
} 

이동 방법 :

(주요 활동에 onDrawFrame()에서 호출) 방법을 렌더링 . 그러나 나는 내가 바꿀 수있는 어떤 것도 보지 못한다. 사람이 공유하시기 바랍니다 어떤 생각 가지고있는 경우)

답변

1

는 개인적으로 내가 도움이 있는지 확인

public void drawScene(GL10 gl) 
{ 
    // Clear scene 
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); 
    // Move left top corner of camera to specified point 
    gl.glTranslatef(-camera.getX(), screenManager.getScreenHeight() - camera.getY(), 0f); 
    // Render all objects from the scene 
    root.renderObjects(gl); 
    // Fixed position for HUD elements 
    gl.glLoadIdentity(); 
    // Render hud to the screen 
    hud.renderObjects(gl); 
    gl.glLoadIdentity(); 
} 

에 drawScene을 바꿀 것입니다. 문제는 렌더 객체 (예 : 외부 스레드)에서 카메라 위치를 변경하거나 부동 소수점이 충분히 정확하지 않을 수 있습니다.

관련 문제