LibGdx使用GL10为gl对象返回NULL

时间:2011-07-18 06:47:29

标签: android

我正在使用LibGdx开发游戏,当我试图在2.2.2版本的motorola atrix中运行游戏时,它不接受GL10并为gl对象赋予null。任何人都可以帮助我。

以下代码:

public class Game2D implements InputProcessor, ApplicationListener {
    public void create() {
        //initializing all
    }

    public void render() {
        GL10 gl = Gdx.graphics.getGL10();
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        Gdx.graphics.getGL10().glViewport(
                0,
                0,
                Gdx.graphics.getWidth(), 
                Gdx.graphics.getHeight()
        );
        camera.update();
        camera.apply(gl);
        //-------------------
    }
}

1 个答案:

答案 0 :(得分:0)

很难说没有看到代码片段,但我觉得你在初始化上下文之前就使用了GL相关的东西。