So I have two beginner graphics questions, working with SDL (on Linux, but that shouldn't matter).
1.) Is it possible to make Transparencies on BMP files?
2.) Since BMP & Wav libraries are built in, where is the ideal place to get libraries for alternative formats, such as jpg/gif/png & mp3?
Thanks...
Game Development in SDLBeginner Graphics Questions
Page 1 of 1
9 Replies - 2144 Views - Last Post: 21 June 2009 - 08:23 AM
Replies To: Game Development in SDL
#2
Re: Game Development in SDL
Posted 17 June 2009 - 10:37 PM
Quote
Is it possible to make Transparencies on BMP files?
Quote
where is the ideal place to get libraries for alternative formats, such as jpg/gif/png & mp3?
#3
Re: Game Development in SDL
Posted 18 June 2009 - 12:58 AM
Oler1s, on 18 Jun, 2009 - 04:37 AM, said:
Quote
where is the ideal place to get libraries for alternative formats, such as jpg/gif/png & mp3?
As for transparency, look at SDL_SetColorKey()
#4
Re: Game Development in SDL
Posted 18 June 2009 - 02:38 AM
I would recommend using SDL image for your image loading definitely and also I would use .png files for your sprites, these files can use an alpha channel for transparency which looks a hell of a lot better than colour keying.
.png files can also be compacted very small, there are .png compressors all over the net if you just google them.
If you use a .png file with SDL_Image it will automatically use the alpha channel for transparency which is great.
.png files can also be compacted very small, there are .png compressors all over the net if you just google them.
If you use a .png file with SDL_Image it will automatically use the alpha channel for transparency which is great.
#5
Re: Game Development in SDL
Posted 18 June 2009 - 03:29 AM
stayscrisp, on 18 Jun, 2009 - 08:38 AM, said:
If you use a .png file with SDL_Image it will automatically use the alpha channel for transparency which is great.
I'll give it another go when I get time (hopefully tomorrow on my NEW LAPTOP) *excited*
This post has been edited by gabehabe: 18 June 2009 - 03:29 AM
#6
Re: Game Development in SDL
Posted 18 June 2009 - 03:44 AM
Thats weird, maybe you aren't creating the alpha channel correctly, this has an alpha channel try it out.
#7
Re: Game Development in SDL
Posted 18 June 2009 - 08:00 AM
Is it worth writing up a tutorial on creating alpha channels and displaying transparency in SDL?
#8
Re: Game Development in SDL
Posted 18 June 2009 - 09:19 AM
MP3 loading is tricky because of patents. Better to go with something like Ogg Vorbis (libvorbisfile) if you want compression, or just use WAV.
You should probably use DevIL or SDL_Image to load images, but writing your own loaders isn't hard. See my TGA, JPEG, and PNG loaders from Dagger3D for example.
Last time I checked, BMP doesn't support transparency but you can pick a color to be treated as transparent. This method won't let you have semi-transparent pixels though, which is probably going to make your sprites/textures a little jaggier along the edges. I recommend using a format that supports RGBA (like TGA) instead.
What are you using to make images? Are you sure you are actually making the background transparent?
You should probably use DevIL or SDL_Image to load images, but writing your own loaders isn't hard. See my TGA, JPEG, and PNG loaders from Dagger3D for example.
Last time I checked, BMP doesn't support transparency but you can pick a color to be treated as transparent. This method won't let you have semi-transparent pixels though, which is probably going to make your sprites/textures a little jaggier along the edges. I recommend using a format that supports RGBA (like TGA) instead.
What are you using to make images? Are you sure you are actually making the background transparent?
#9
Re: Game Development in SDL
Posted 18 June 2009 - 10:36 AM
You were right! Just tested it with your png and one that I just created. Fuck knows what was up with it before.
#10
Re: Game Development in SDL
Posted 21 June 2009 - 08:23 AM
Created a tutorial for creating PNG files with transparency. Its in the photoshop tutorial section.
http://www.dreaminco...showforum44.htm
http://www.dreaminco...showforum44.htm
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote









|