Can a texture have a color key? If so, how do you set it and retrieve its value?
Textures don’t have colorkey, instead you should create a texture with an
alpha channel.
You can take a look at SDL_ConvertColorkeyToAlpha() in SDL_surface.c for an
example.On Sat, Jul 4, 2009 at 12:41 PM, Mason Wheeler wrote:
Can a texture have a color key? If so, how do you set it and retrieve its
value?
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
You could use a fragment shader to achieve the desired effect as well.On Fri, Aug 7, 2009 at 5:56 AM, Sam Lantinga wrote:
Textures don’t have colorkey, instead you should create a texture with an
alpha channel.
You can take a look at SDL_ConvertColorkeyToAlpha() in SDL_surface.c for an
example.
Three problems with that.
One, the abstraction inversions implied by such a course of action make me
shudder just thinking about it.
Two, this would require me to keep track of the colorkey value of every single
image file I load (they’re not always the same, and this is a factor beyond my
control), find a way of associating it with the textures I create, and passing it
to the shader every time.
Three, I don’t think SDL has any shader APIs. That would be a definite value
add, though…> ----- Original Message -----
From: donny.viszneki@gmail.com (Donny Viszneki)
Subject: Re: [SDL] Textures and color keysOn Fri, Aug 7, 2009 at 5:56 AM, Sam Lantinga wrote:
Textures don’t have colorkey, instead you should create a texture with an
alpha channel.
You can take a look at SDL_ConvertColorkeyToAlpha() in SDL_surface.c for an
example.You could use a fragment shader to achieve the desired effect as well.
While IMHO these are all whiny complaints that shouldn’t stop anyone
from cutting their texture memory allocation by 25% (eliminating the
alpha channel) I didn’t say this couldn’t be implemented in SDL, as
opposed to on top of the existing SDL API ;)On Fri, Aug 7, 2009 at 12:56 PM, Mason Wheeler wrote:
Three problems with that.
One, the abstraction inversions implied by such a course of action make me
shudder just thinking about it.Two, this would require me to keep track of the colorkey value of every single
image file I load (they’re not always the same, and this is a factor beyond my
control), find a way of associating it with the textures I create, and passing it
to the shader every time.Three, I don’t think SDL has any shader APIs. That would be a definite value
add, though…
Three problems with that.
One, the abstraction inversions implied by such a course of action make me
shudder just thinking about it.Two, this would require me to keep track of the colorkey value of every single
image file I load (they’re not always the same, and this is a factor beyond my
control), find a way of associating it with the textures I create, and passing it
to the shader every time.Three, I don’t think SDL has any shader APIs. That would be a definite value
add, though…While IMHO these are all whiny complaints that shouldn’t stop anyone
from cutting their texture memory allocation by 25% (eliminating the
alpha channel) I didn’t say this couldn’t be implemented in SDL, as
opposed to on top of the existing SDL API
That would require a bit of reworking. Right now, as far as I can tell, there’s no
way to create an RGB-only texture.>----- Original Message ----
From: Donny Viszneki <donny.viszneki at gmail.com>
Subject: Re: [SDL] Textures and color keys
On Fri, Aug 7, 2009 at 12:56 PM, Mason Wheeler<@Mason_Wheeler> wrote: