LibGDX RayHandler:当像素解包缓冲对象被禁用时不能使用偏移



我最近更新了我在游戏中使用的LibGDX库,使用LibGDX设置程序创建一个新项目,然后将我所有的类,资产等导入到新项目中。一切正常,游戏运行,我可以进入主菜单。然而,当我尝试前进到我有Box2DLights的游戏时,我在RayHandler的实例化上得到一个错误。RayHandler是这样被实例化的:

rays = new RayHandler(world, Game.V_WIDTH/LIGHT_PIXEL_SIZE, Game.V_HEIGHT/LIGHT_PIXEL_SIZE);

这在LibGDX库的旧版本中工作,但现在它抛出Exception in thread "LWJGL Application" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Pixel Unpack Buffer Object is disabled

LibGDX的旧版本有GL20,这个版本有GL30。我不确定这是否相关,因为我对OpenGL知之甚少。

将行Gdx.gl.glBindBuffer(GL30.GL_PIXEL_UNPACK_BUFFER, 1);放在我的RayHandler实例化之前将错误更改为Exception in thread "LWJGL Application" java.lang.IllegalStateException: Frame buffer couldn't be constructed: incomplete attachment。在我的RayHandler再次被实例化的那一行抛出。

第一个错误的整个相关堆栈跟踪是:
Exception in thread "LWJGL Application" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Pixel Unpack Buffer Object is disabled
at org.lwjgl.opengl.GLChecks.ensureUnpackPBOenabled(GLChecks.java:125)
at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2899)
at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glTexImage2D(LwjglGL20.java:598)
at com.badlogic.gdx.graphics.glutils.GLOnlyTextureData.consumeCustomData(GLOnlyTextureData.java:78)
at com.badlogic.gdx.graphics.GLTexture.uploadImageData(GLTexture.java:270)
at com.badlogic.gdx.graphics.GLTexture.uploadImageData(GLTexture.java:257)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:159)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:147)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:142)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.createTexture(FrameBuffer.java:81)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.createTexture(FrameBuffer.java:42)
at com.badlogic.gdx.graphics.glutils.GLFrameBuffer.build(GLFrameBuffer.java:174)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:75)
at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:57)
at box2dLight.LightMap.<init>(LightMap.java:118)
at box2dLight.RayHandler.resizeFBO(RayHandler.java:143)
at box2dLight.RayHandler.<init>(RayHandler.java:132)

我的问题已经被LibGDX Discord服务器上的人回答了。他们和我分享了这个:https://github.com/libgdx/libgdx/issues/6407谁知道会有不是我的错的bug呢?将GDX版本从1.9.14更改为1.9.15-SNAPSHOT修复了此问题。

最新更新