OpenGL Texture Blending

74 Views Asked by At

I have made a WebGL port of Minecraft Classic 0.30 Survival Test using TeaVM and I'm having some issues with WebGL texture blending.

Here is the code I'm using:

if(textureName.equals("/terrain.png") || textureName.equals("/arrow.png")) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

Here is the result: https://i.stack.imgur.com/SpRg3.png

Do I have to use any GLSL or is there a way I can do it without it?

Edit: Here is the source code if anybody wants to look at it.

1

There are 1 best solutions below

0
PeytonPlayz595 On

I got it working by doing this:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_LESS, 1.0F);