2

I'm writing an Alpha Map Lighting system, and I've been successful to some degree. Here is my code:

g.clearAlphaMap();
g.setDrawMode(Graphics.MODE_ALPHA_MAP);

GL11.glEnable(SGL.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
g.setAntiAlias(true);

World.alphaImage.draw((200*World.tileConstant+World.globalOffsetX) - 150,(200*World.tileConstant+World.globalOffsetY) - 150, 300, 300);

g.setDrawMode(Graphics.MODE_ALPHA_BLEND);

GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_ALPHA,GL11.GL_DST_ALPHA);
Color color = new Color(0, 0, 0, .5F);
g.setColor(color);
g.fillRect(0, 0, 900, 600);

g.setDrawMode(Graphics.MODE_NORMAL);

The issue is, when I do:

Color color = new Color(0, 0, 0, .5F);
g.setColor(color);
g.fillRect(0, 0, 900, 600);

It just shows a fully opaque black where it is not lit up rather than 0.5f. Any ideas why?

Quinn Finney
  • 523
  • 1
  • 6
  • 14

0 Answers0