LibGDX with Box2DLights: How to fix "Array Buffer Object"-Exception?

185 Views Asked by At

I'm using Box2DLights with LibGDX. But everytime I'm running the app, only one frame will pop up and immediately the exception will get thrown like that:

Exception in thread "LWJGL Application" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Array Buffer Object is disabled
    at org.lwjgl.opengl.GLChecks.ensureArrayVBOenabled(GLChecks.java:77)
    at org.lwjgl.opengl.GL20.glVertexAttribPointer(GL20.java:892)
    at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glVertexAttribPointer(LwjglGL20.java:847)
    at com.badlogic.gdx.graphics.glutils.ShaderProgram.setVertexAttribute(ShaderProgram.java:683)
    at com.badlogic.gdx.graphics.glutils.VertexBufferObject.bind(VertexBufferObject.java:190)
    at com.badlogic.gdx.graphics.Mesh.bind(Mesh.java:380)
    at com.badlogic.gdx.graphics.Mesh.bind(Mesh.java:371)
    at com.badlogic.gdx.graphics.Mesh.render(Mesh.java:479)
    at com.badlogic.gdx.graphics.Mesh.render(Mesh.java:422)
    at box2dLight.LightMap.render(LightMap.java:59)
    at box2dLight.RayHandler.render(RayHandler.java:338)
    at box2dLight.RayHandler.updateAndRender(RayHandler.java:269)
    at de.marc_manhart.ecs.entities.systems.RenderingSystem.update(RenderingSystem.java:155)

In my RenderingSystem (I'm using an ECS approach with ashley), this is my constructor:

public RenderingSystem(...) {
        //...       

        // ------ Box2DLights
        RayHandler.setGammaCorrection(true);
        RayHandler.useDiffuseLight(false);       
        this.rayHandler=new RayHandler(this.world);
        this.rayHandler.setBlur(true);
        this.rayHandler.setBlurNum(1);
        this.rayHandler.setShadows(true);
        this.rayHandler.setCulling(true);
        this.rayHandler.setAmbientLight(0.9f);


        // Two PointLights just for test here
        new PointLight(rayHandler, 500, Color.RED, 50, -5, 10);
        new PointLight(rayHandler, 500, new Color(1f, 0.5f, 1f, 1f), 150, 0, 30);

    }

And in update Method where I'm doing the rendering-stuff:

@Override
public void update(float deltaTime) {
        //...
        rayHandler.setCombinedMatrix(gameWorldCam);
        rayHandler.updateAndRender();
        rayHandler.dispose();
}

I have no Idea how to fix or even how to interpret this error.

0

There are 0 best solutions below