Hello Guest

Color overlay on Texture (sprite)

  • 4 Replies
  • 6970 Views
Color overlay on Texture (sprite)
« on: April 28, 2007, 20:59:05 »
Hello,

I'm trying to overlay a color over a sprite, so that the sprite turns red for a few seconds when hit, I add a sample as attachment.

I've loaded my texture with GL11.GL_TEXTURE_2D and GL11.GL_RGBA, any help would be apreciated.

Thanks and regards, Roger.

*

Offline ndhb

  • **
  • 70
Re: Color overlay on Texture (sprite)
« Reply #1 on: April 28, 2007, 22:26:42 »
« Last Edit: April 28, 2007, 22:44:09 by ndhb »

Re: Color overlay on Texture (sprite)
« Reply #2 on: May 08, 2007, 17:14:10 »
Hello,

Thanks for the reply, your code was really useful. I've had to change it a little, because I also use transparent sprites, so that's how it looks now:

GL14.glBlendColor(1f, 0, 0, 0);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);

The problem is that it isn't really red, it looks like if the sprite has been dakened, but not red, there's a sample attached. Do you know a way to solve this? I've tryed changing the glBlendColor indexes, but with no luck so far.

Re: Color overlay on Texture (sprite)
« Reply #3 on: May 08, 2007, 18:36:35 »
you might need to enable texture modulation:
GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

*

Offline ndhb

  • **
  • 70
Re: Color overlay on Texture (sprite)
« Reply #4 on: May 09, 2007, 20:43:34 »