I am binding a texture to draw over some geometry (using the ImmediateModeRenderer20) but the alpha channel of the texture turns into colour black when drawn. Why is that happening?

My draw call loop looks sort of like this:

immediateModeRenderer20.begin(renderer.getUiCamera().combined, GL20.GL_TRIANGLE_STRIP);
immediateModeRenderer20.color(new Color(1, 1, 1, 1));
immediateModeRenderer20.texCoord(distance, tc.y);
immediateModeRenderer20.vertex(point.x, point.y, 0f);
  • \$\begingroup\$ Most likely because you set the internalFormat parameter to GL_RGB when loading the texture. \$\endgroup\$ – Maximus Minimus Jul 10 '17 at 17:05
  • \$\begingroup\$ @LeComteduMerde-fou I have not, but if that's the default then it might be the case. Can you help me with changing it? \$\endgroup\$ – kacpr Jul 10 '17 at 18:03
  • \$\begingroup\$ Look at your glTexImage call. \$\endgroup\$ – Maximus Minimus Jul 10 '17 at 18:57

Make sure blending is enabled. Otherwise OpenGL will not blend between overlapping fragments.


Also you need to specify which factors are used for the blending calculation. This would be additive blending:


After your end() function you should disable blending again, as it may not be wanted for other calls.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.