Search code examples
libgdx

Decal Batch doesn't work on all devices Libgdx


I tried rendering using Libgdx's DecalBatch on my phone and my friend's phone. It's rendering a 2D image with thickness.

A decal at the front and back side is created, then individual decals for every pixel at its side.

Then, I flush (render) the decals.

On my phone, it gave this result: My Phone (this works) It worked as expected.

However, on my friend's phone, it didn't render at all: Friend's phone (this didn't work) It didn't work as expected.

How do I fix this? Or is it a bug in Libgdx?


Solution

  • I've got it working now!

    I forgot to add this one line of code:

    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    

    I mainly forgot to put the depth buffer bit. Anyways, thank you to everyone who has helped.