gpt4 book ai didi

java - Libgdx:不支持的格式组合

转载 作者:行者123 更新时间:2023-12-01 18:20:16 25 4
gpt4 key购买 nike

我已在 Play 商店上发布了我的游戏,但在某些设备上收到无法构建帧缓冲区:不支持的格式组合错误。以下是包含此报告的设备列表:

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 settings

最佳答案

查看 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);
}

关于java - Libgdx:不支持的格式组合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27826076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com