(LibGDX) Android 应用程序在创建 FrameBuffers 时崩溃
(LibGDX) Android app crashes when creating FrameBuffers
我从 Google Play 商店收到了我的 Android 使用 LibGDX 创建的应用程序的崩溃报告。
Huawei MediaPad T3 7 (hwbg2), Android 6.0
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.badlogic.gdx.graphics.glutils.FrameBuffer.createFrameBuffer (FrameBuffer.java:72)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.createFrameBuffer (FrameBuffer.java:56)
at MY_PACKAGE.editor.Backup.<init> (Backup.java:21)
at MY_PACKAGE.editor.EditingImage.<init> (EditingImage.java:277)
at MY_PACKAGE.screens.EditingScreen.<init> (EditingScreen.java:227)
at MY_PACKAGE.screens.Screens.<init> (Screens.java:42)
at MY_PACKAGE.MAIN_CLASS.run (MAIN_CLASS.java:121)
at MY_PACKAGE.screens.SplashScreen.render (SplashScreen.java:93)
at com.badlogic.gdx.Game.render (Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame (AndroidGraphics.java:495)
at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1599)
at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1295)
代码位于 GLFrameBuffer.java:233
if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");
EditingImage.java如下
class EditingImage{
public static final int pixmapWidth = 1024;
public EditingImage{
frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888,pixmapWidth,pixmapWidth,false);
....
for (int i = 0; i < 50; i++){
final Backup backup = new Backup(pixmapWidth);
availableBackups.add(backup);
}
}
}
Backup.java如下
Backup(int width){
frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888, width, width, false);
....
}
应用程序在创建 FrameBuffer 时在 Backup.java 内崩溃(我不知道循环了多少次)。
正如你所见,在EditingImage中创建的FrameBuffer并没有崩溃,它已经在实例化Backup对象之前执行了。
在我的phone(华为Y6II)上正常。也已经在一些三星 phones.
测试过
请帮忙!
1 年 11 个月后我发现了问题。
根据文档:
它表示在构造函数中作为参数传递的格式应该是 RGB565 或 RGBA4444 或 RGB5_A1
format - the format of the color buffer; according to the OpenGL ES
2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are color-renderable
在我的例子中,我使用了 RGB888
我从 Google Play 商店收到了我的 Android 使用 LibGDX 创建的应用程序的崩溃报告。
Huawei MediaPad T3 7 (hwbg2), Android 6.0
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.badlogic.gdx.graphics.glutils.FrameBuffer.createFrameBuffer (FrameBuffer.java:72)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.createFrameBuffer (FrameBuffer.java:56)
at MY_PACKAGE.editor.Backup.<init> (Backup.java:21)
at MY_PACKAGE.editor.EditingImage.<init> (EditingImage.java:277)
at MY_PACKAGE.screens.EditingScreen.<init> (EditingScreen.java:227)
at MY_PACKAGE.screens.Screens.<init> (Screens.java:42)
at MY_PACKAGE.MAIN_CLASS.run (MAIN_CLASS.java:121)
at MY_PACKAGE.screens.SplashScreen.render (SplashScreen.java:93)
at com.badlogic.gdx.Game.render (Game.java:46)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame (AndroidGraphics.java:495)
at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1599)
at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1295)
代码位于 GLFrameBuffer.java:233
if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");
EditingImage.java如下
class EditingImage{
public static final int pixmapWidth = 1024;
public EditingImage{
frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888,pixmapWidth,pixmapWidth,false);
....
for (int i = 0; i < 50; i++){
final Backup backup = new Backup(pixmapWidth);
availableBackups.add(backup);
}
}
}
Backup.java如下
Backup(int width){
frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888, width, width, false);
....
}
应用程序在创建 FrameBuffer 时在 Backup.java 内崩溃(我不知道循环了多少次)。
正如你所见,在EditingImage中创建的FrameBuffer并没有崩溃,它已经在实例化Backup对象之前执行了。
在我的phone(华为Y6II)上正常。也已经在一些三星 phones.
测试过请帮忙!
1 年 11 个月后我发现了问题。
根据文档:
它表示在构造函数中作为参数传递的格式应该是 RGB565 或 RGBA4444 或 RGB5_A1
format - the format of the color buffer; according to the OpenGL ES 2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are color-renderable
在我的例子中,我使用了 RGB888