创建SpriteBatch抛出IllegalArgumentException

时间:2015-06-17 10:02:44

标签: libgdx glsl shader vertex-shader

我使用了2个阶段。一个用于控制栏(按钮),一个用于游戏。 该错误是从Google Galaxy Nexus发送的 - 4.2.2

这是我的代码

public BaseScreen(MyGame game) {
    cam = new OrthographicCamera();
    cam.setToOrtho(true, game.getGameWidth(), game.getGameHeight());
    camera = new PerspectiveCamera();
    viewport = new FitViewport(gameWidth, gameHeight, camera);

    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setProjectionMatrix(cam.combined);
    batcher = new SpriteBatch();
    batcher.setProjectionMatrix(cam.combined);
}

并记录:

STACK_TRACE=java.lang.IllegalArgumentException: Error compiling shader: Vertex shader(s) failed to link, fragment shader(s) failed to link.
ERROR: error(#275) Symbol 'v_texCoords' is defined with 2 different types between two stages
ERROR: error(#275) Symbol 'v_texCoords' is defined with 2 different types between two stages
at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:158)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:121)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:74)
at c.j.a.<init>(BaseScreen.java:118)
at c.j.e.<init>(GameScreen.java:11)
at c.a.a(GOGGame.java:270)
at c.j.b.render(CardLobbyLoadingScreen.java:130)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

0 个答案:

没有答案