質問

Hello my rendering is very glitchy on Tegra 3 devices.. any Idea how this is possible? Here are two screens. the first one is the glitchy one from an Asus A510 tablet and the second is the correct rendering on my galaxy nexus

glitchy Tegra 3

correct rendering on gnex

And here is my code of the render class:

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();

}

  }

thank you...

役に立ちましたか?

解決

ok solved the Problem. The glitch caused a guiElement, that had a strange blend config...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top