libGDX IllegalStateException on some devices

Viewed 71

I've launched my new game libGDX on play store and I start getting crash reports. This problem started when I updated to newer version on libgdx 1.9.7. Here is my crash report:

  java.lang.IllegalStateException: 
  at com.badlogic.gdx.graphics.glutils.GLFrameBuffer.build (GLFrameBuffer.java:233)     
  at com.badlogic.gdx.graphics.glutils.GLFrameBuffer.<init> (GLFrameBuffer.java:87)
  at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init> (FrameBuffer.java:51)
  at com.badlogic.gdx.graphics.glutils.GLFrameBuffer$FrameBufferBuilder.build (GLFrameBuffer.java:474)
  at com.dui.Screens.DirectedGame.setScreen (DirectedGame.java:57)
  at com.dui.DuiGame.create (DuiGame.java:20)
  at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged (AndroidGraphics.java:311)
  at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1528)
  at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1249)

Here is my setScreen method:

    public void setScreen(AbstractGameScreen screen, ScreenTransition screenTransition) {
        int w = Gdx.graphics.getWidth();
        int h = Gdx.graphics.getHeight();
        if (!init) {

            GLFrameBuffer.FrameBufferBuilder frameBufferBuilder = new GLFrameBuffer.FrameBufferBuilder(w, h);
            frameBufferBuilder.addColorTextureAttachment(GL30.GL_RGB8, GL30.GL_RGB, GL30.GL_UNSIGNED_BYTE);

            currFbo = frameBufferBuilder.build();
            nextFbo = frameBufferBuilder.build();

            batch = new SpriteBatch();
            init = true;
        }
        // start new transition
        nextScreen = screen;
        nextScreen.show(); // activate next screen
        nextScreen.resize(w, h);
        nextScreen.render(0); // let next screen update() once
        if (currScreen != null) currScreen.pause();
        nextScreen.pause();
        Gdx.input.setInputProcessor(null); // disable input
        this.screenTransition = screenTransition;
        t = 0;
    }

In libgdx news page there is example for building a custom FrameBuffer, but I'm not sure if I implement it correctly?

Can some one give me solution for my problem ?

Thanks

0 Answers
Related