2013-01-11 2 views
0

안녕하세요. Tegra 3 기기에서 렌더링이 매우 이상합니다. 어떻게 가능합니까? 두 화면이 있습니다. 첫 번째는 아수스 A510 태블릿에서 glitchy 하나이며, 두 번째는meshobjects가 이상하지만 Tegra 3 기기에서만 가능

glitchy Tegra 3

correct rendering on gnex

그리고 여기가 렌더링 클래스의 내 코드 내 갤럭시 넥서스에 대한 올바른 렌더링 :

public class ShowCaseRenderer { 

GLGraphics glGraphics; 
LookAtCamera camera; 

AmbientLight ambientLight; 
DirectionalLight directionalLight; 
public float rotation = 0; 
public static float rotationCamera = 0; 

private Vector2 camDirection; 

public static final int SWIPE_LEFT = -1; 
public static final int SWIPE_RIGHT = 1; 

public ShowCaseRenderer(GLGraphics glGraphics) { 

    camDirection = new Vector2(); 

    this.glGraphics = glGraphics; 
    camera = new LookAtCamera(67, glGraphics.getWidth() 
      /(float) glGraphics.getHeight(), 0.1f, 100); 

    ambientLight = new AmbientLight(); 
    ambientLight.setColor(0.2f, 0.2f, 0.2f, 1.0f); 
    directionalLight = new DirectionalLight(); 
    directionalLight.setDirection(-1, -0.5f, 0); 

    GL10 gl = glGraphics.getGL(); 
    gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight()); 
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); 
    gl.glMatrixMode(GL10.GL_PROJECTION); 
    gl.glLoadIdentity(); 
    GLU.gluPerspective(gl, 67, 
      glGraphics.getWidth()/(float) glGraphics.getHeight(), 0.1f, 
      10.0f); 

} 

public void render(int swipe, float deltaTime) { 

    GL10 gl = glGraphics.getGL(); 



    camDirection.set((float) Math.cos(rotationCamera * Vector2.TO_RADIANS), 
      (float) Math.sin(rotationCamera * Vector2.TO_RADIANS)).nor(); 

    camera.getPosition().set(0, 0, 0) 
      .sub(camDirection.x * 2.55f, -0.4f, camDirection.y * 2.5f); 

    camera.getLookAt().set(0, 0, 0); 

    camera.setMatrices(gl); 

    gl.glEnable(GL10.GL_DEPTH_TEST); 
    gl.glEnable(GL10.GL_TEXTURE_2D); 
    gl.glEnable(GL10.GL_LIGHTING); 
    gl.glEnable(GL10.GL_COLOR_MATERIAL); 
    gl.glEnable(GL10.GL_BLEND); 

    ambientLight.enable(gl); 
    directionalLight.enable(gl, GL10.GL_LIGHT0); 

    if (swipe == SWIPE_LEFT && rotationCamera % 90 != 0) { 

     rotationCamera = rotationCamera -= 1.5f; 

    } 

    if (swipe == SWIPE_RIGHT && rotationCamera % 90 != 0) { 

     rotationCamera = rotationCamera += 1.5f; 

    } 

    if (rotationCamera == 360) 
     rotationCamera = 0; 
    if (rotationCamera < 0) 
     rotationCamera = rotationCamera + 360; 

    //eigenRotation der Autos 
    rotation = rotation += deltaTime * 25; 
    if (rotation > 360) { 
     rotation = rotation - 360; 
    } 

    renderShowCase(gl); 



    gl.glDisable(GL10.GL_TEXTURE_2D); 

    gl.glDisable(GL10.GL_COLOR_MATERIAL); 
    gl.glDisable(GL10.GL_LIGHTING); 
    gl.glDisable(GL10.GL_DEPTH_TEST); 
    gl.glDisable(GL10.GL_BLEND); 
} 

private void renderShowCase(GL10 gl) { 

    Assets.ectoMobileTexture.bind(); 
    Assets.ectoMobileModel.bind(); 

    gl.glPushMatrix(); 

    gl.glTranslatef(0, 0.01f, -1.5f); 

    gl.glRotatef(-rotation, 0, 1, 0); 

    Assets.ectoMobileModel.draw(GL10.GL_TRIANGLES, 0, 
      Assets.ectoMobileModel.getNumVertices()); 
    gl.glPopMatrix(); 

    Assets.ectoMobileModel.unbind(); 

    Assets.batMobileTexture.bind(); 
    Assets.batMobileModel.bind(); 

    gl.glPushMatrix(); 

    gl.glTranslatef(0, 0.01f, 1.5f); 

    gl.glRotatef(-rotation, 0, 1, 0); 

    Assets.batMobileModel.draw(GL10.GL_TRIANGLES, 0, 
      Assets.batMobileModel.getNumVertices()); 
    gl.glPopMatrix(); 

    Assets.batMobileModel.unbind(); 

    Assets.mysteryMachineTexture.bind(); 
    Assets.mysteryMachineModel.bind(); 

    gl.glPushMatrix(); 

    gl.glTranslatef(-1.5f, 0.01f, 0); 

    gl.glRotatef(-rotation, 0, 1, 0); 

    Assets.mysteryMachineModel.draw(GL10.GL_TRIANGLES, 0, 
      Assets.mysteryMachineModel.getNumVertices()); 
    gl.glPopMatrix(); 

    Assets.mysteryMachineModel.unbind(); 

    Assets.podRacerTexture.bind(); 
    Assets.podRacerModel.bind(); 

    gl.glPushMatrix(); 

    gl.glTranslatef(1.5f, 0.01f, 0); 

    gl.glRotatef(-rotation, 0, 1, 0); 

    Assets.podRacerModel.draw(GL10.GL_TRIANGLES, 0, 
      Assets.podRacerModel.getNumVertices()); 
    gl.glPopMatrix(); 

    Assets.podRacerModel.unbind(); 

} 

    } 

감사합니다 ...

답변

1

괜찮습니다. 글리치가 guiElement를 일으켰습니다. 이상한 블렌드 설정이있었습니다 ...