What does SDL_TEXTUREMODULATE_COLOR do?

It looks like this provides some extra color to mix with the current texture, but I don’t really understand what it does or how. Are there any examples for using it?

sounds like GL_MODULATE for glTexEnvf(). It multiplies each color value in
the source texture by the color set with glColor4f().

So, if you load an image of a while circle into a texture, set the drawing
color to blue, then display that texture, you get a blue circle.

I’ve used this myself in SDL1.2 + GL to recolor sprites and save on data size
and textures.On Friday, 3 July 2009 18:39:45 Mason Wheeler wrote:

It looks like this provides some extra color to mix with the current
texture, but I don’t really understand what it does or how. Are there any
examples for using it?

Interesting. Doesn’t sound like quite what I was looking for, though.

The Asphyre library for Delphi had an enumerated list of constants that it
could use to change the drawing properties of a sprite. One of them,
fxOneColor, made the entire sprite draw in a single color instead of using
the color data for the image. The only values that mattered were color
key and alpha. I was able to use that to make a sprite “flash” to another
color and slowly fade back to normal like this:

procedure TTile.Draw;
var
timer: cardinal;
begin
inherited Draw;
if assigned(FFlashTimer) then
begin
timer := FFlashTimer.timeRemaining;
if timer > 0 then
begin
saveColor;
FSavedFx := self.DrawFx;
restoreColor(FFlashColor);
self.DrawFx := fxOneColor;
inherited Draw;
moveTowards(timer, FFlashColor.alpha, 0);
restoreColor(FSavedColor);
self.DrawFx := FSavedFx;
end
else freeAndNil(FFlashTimer);
end;
end;

Basically, draw the sprite normally, then draw a solid color with the same
shape over the top of it, and that shape’s alpha gets gradually decreased
towards 0 over time.

Any idea how I could accomplish that on SDL?

It looks like this provides some extra color to mix with the current
texture, but I don’t really understand what it does or how. Are there any
examples for using it?

sounds like GL_MODULATE for glTexEnvf(). It multiplies each color value in
the source texture by the color set with glColor4f().

So, if you load an image of a while circle into a texture, set the drawing
color to blue, then display that texture, you get a blue circle.

I’ve used this myself in SDL1.2 + GL to recolor sprites and save on data size
and textures.From: llubnek@gmail.com (Kenneth Bull)
Subject: Re: [SDL] What does SDL_TEXTUREMODULATE_COLOR do?
On Friday, 3 July 2009 18:39:45 Mason Wheeler wrote:

With OpenGL, that would be something like:

glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_PRIMARY_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_TEXTURE);

… I think. No guarantees.
See http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml for more info.

With SDL 1.3 I don’t think there’s an easy way to do this.On Saturday, 4 July 2009 08:56:09 Mason Wheeler wrote:

Interesting. Doesn’t sound like quite what I was looking for, though.

The Asphyre library for Delphi had an enumerated list of constants that it
could use to change the drawing properties of a sprite. One of them,
fxOneColor, made the entire sprite draw in a single color instead of using
the color data for the image. The only values that mattered were color
key and alpha. I was able to use that to make a sprite “flash” to another
color and slowly fade back to normal like this:

Basically, draw the sprite normally, then draw a solid color with the same
shape over the top of it, and that shape’s alpha gets gradually decreased
towards 0 over time.

Any idea how I could accomplish that on SDL?