我在Play商店推出了我的新游戏libGDX
,我开始收到崩溃报告。
当我在libgdx 1.9.7上更新到更新版本时,这个问题就出现了。
这是我的崩溃报告:
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)
这是我的setScreen方法:
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;
}
在libgdx
news page中有一个构建自定义FrameBuffer
的示例,但我不确定我是否正确实现了它?
有人可以给我解决我的问题吗?
谢谢