[SDL] PNG Alpha Transparentcy

Jonathan Dearborn grimfang4 at gmail.com
Fri Dec 3 17:42:10 PST 2010


It's SDL 1.2, right?  SDL_image does load the alpha channel.  If you're
using OpenGL, you will probably need to enable alpha blending with
glEnable(GL_BLEND).

Jonny D


On Fri, Dec 3, 2010 at 5:38 PM, Christian Leger <chrism.leger at gmail.com>wrote:

> Hi,
>
> I've had this exact problem. I don't even know whether or not the SDL_image
> libs support keeping the alpha when loading png's.
>
> What I've done is to write a simple conversion function which takes a
> 24-bit image and converts it to a 32-bit image, assigning alpha of 255
> everywhere that the image isn't black, and alpha of 0 everywhere else. If
> that sounds like code you could use, I'll gladly send it over.
>
> Thanks,
>
> Christian
>
> On Fri, Dec 3, 2010 at 5:11 PM, image28 <image28 at slingshot.co.nz> wrote:
>
>>  I replaced the line SDL_LoadBMP with SDL-image's IMG_Load function in
>> the testgl.c program from the tests folder in the SDL source package.
>> But the image no long shows up transparent, it has a black background
>> around it. I made the transparent png file with the gimp... Any ideas?
>>
>> Thanks,
>> Image
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>
>>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101203/9aabd48e/attachment-0008.htm>


More information about the SDL mailing list