I'm having a problem with a texture which has transparent areas. Basically it is a texture of a coin rendered onto a cube. I can't get the corners to appear transparent, they just show up as white/gray.
I made sure to enable G20.GL_Blend
, so that can't be it.
This is the code I use in the render()
method (I tried different combinations):
Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
Gdx.gl20.glEnable(GL20.GL_BLEND);
Gdx.gl20.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
Gdx.gl20.glBlendEquation(GL20.GL_BLEND);
modelBatch.begin(cam);
texture.bind();
modelBatch.render(instance, environment);
modelBatch.end();
Gdx.gl20.glDisable(GL20.GL_TEXTURE_2D);