Libgdx:不支持的格式组合

时间:2015-01-07 18:24:18

标签: java opengl-es libgdx opengl-es-2.0

我在Play商店发布了游戏,但在某些设备上收到frame buffer couldn't be constructed: unsupported combination of formats错误。以下是包含此报告的设备列表:

Galaxy Ace2 (GT-I8160
Galaxy Note (GT-N7000)
maxwell_c7016
hsdroid
Galaxy S2 (GT-I9100)

这是堆栈跟踪:

java.lang.IllegalStateException: frame buffer couldn't be constructed: unsupported combination of formats
at com.badlogic.gdx.graphics.glutils.FrameBuffer.build(FrameBuffer.java:204)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:116)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:98)
at com.ons.era.screens.DirectedGame.setScreen(DirectedGame.java:37)
at com.ons.era.EraGame.create(EraGame.java:21)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1455)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

我试图在网上找到任何解决方案,但没有运气。

我在GDX Texture Packer中使用此设置我不确定这是否是崩溃的原因

Texture Packer settings

2 个答案:

答案 0 :(得分:2)

查看Javadoc的FrameBuffer构造函数。如果您的目标是GLES 2.0,则需要选择其中一种格式:

  

format - the format of the color buffer; according to the OpenGL ES   2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are color-renderable

有些设备支持超过GLES 2.0所要求的最低要求,但据我所知,测试支持的方法并不比捕获此异常更简单。我所做的是使用我喜欢的格式构造FrameBuffer,捕获IllegalStateException,并在必要时使用其中一种保证格式。

例如:

FrameBuffer frameBuffer;
try {
    frameBuffer = new FrameBuffer(Format.RGBA8888, 1024, 1024, false, false);
} catch (IllegalStateException e){
    frameBuffer = new FrameBuffer(Format.RGB565, 1024, 1024, false, false);
}

答案 1 :(得分:1)

在此上下文中,帧缓冲区表示屏幕,而不是纹理。也许您正在创建一个帧缓冲区,其中包含不受支持的深度位或颜色分量(例如alpha)。可能有一种方法可以查询支持的格式。