SFML community forums

General => General discussions => Topic started by: Laurent on October 27, 2007, 05:35:58 pm

Title: Less formats vs less dependencies ?
Post by: Laurent on October 27, 2007, 05:35:58 pm
Hi

I've found a tiny library for loading and saving some image formats, which I could directly integrate to the SFML source code. It would remove the dependency to DevIL and zlib, but not all the formats currently supported would still be there.

However, the supported formats would be the most common ones :
- BMP
- TGA
- JPG
- PNG
- DDS

I need to know what is the most important for you : being able to manipulate uncommon image formats, or having less external dependencies ?

Thanks :)
Title: Less formats vs less dependencies ?
Post by: Lord Delvin on October 27, 2007, 07:02:55 pm
Voted yes:

I think it would be good to have less dependencies, but I also think, that, as you are using DevIL, you wont be able to add this dependencies' functionality in an accaptable amount of time, so I wont suggest to move away from devil.

If you have portable code to load and save these formats and to take screenshot, remove DevIL.
Have fun!
Title: Less formats vs less dependencies ?
Post by: dunce on October 29, 2007, 12:50:14 pm
Why not use FreeImage instead of DevIl? Its license allows static linking. And it supports most common image file formats. I guess it will require libpng and libjpeg. Those libs' licenses allow static linking as well. Thus we can avoid using devil.dll that is lgpl-ed and requires dynamic linking.
BTW, sound lib dependency still remains. I mean OpenAl distribution pack.
Title: Less formats vs less dependencies ?
Post by: DrEvil on October 30, 2007, 04:18:34 pm
I'm trying to get away from dependencies, as I have a somewhat unique project where I can't depend on an installer to install files to the path, and since no dependencies ever allow you to control what folder they load from I need to avoid them. I would very much like to see a version stripped of its external dependencies(dlls), even if that meant slightly reduced functionality.
Title: Less formats vs less dependencies ?
Post by: dabo on October 30, 2007, 07:01:14 pm
If the only things we loose are some uncommon image formats, I'm all for it.
Title: Less formats vs less dependencies ?
Post by: PM on October 31, 2007, 12:08:07 am
Most projects only need one format anyway. For games, most of the times, it's TGA.

And if some project requires as many as possible formats - they can set up DevIL (or some other library) on their own, imho.

EDIT: Perhaps, you should allow some conditional compilation with preprocessor macros? That way, you could actually support more than one common image library (not at the same time, of course).
Title: Re: Less formats vs less dependencies ?
Post by: acrin1 on October 31, 2007, 02:18:17 pm
I'd be fine with less file formats. I really only use PNG and BMP. The fewer DLLs or additional files that need to be shipped with an SFML application or game, the better.
Title: Less formats vs less dependencies ?
Post by: DrEvil on October 31, 2007, 05:06:01 pm
Laurent, what library specifically were you thinking of using? I'm very interested.
Title: Less formats vs less dependencies ?
Post by: Laurent on November 01, 2007, 02:21:10 am
I'd like to use SOIL (http://www.lonesock.net/soil.html), without the OpenGL stuff. This code is itself based on the stb_image (http://www.nothings.org/stb_image.c) source code. Both of them are public domain.

I'm also interested in stb_vorbis (from the same author as stb_image), to get rid of libvorbis.
Title: Less formats vs less dependencies ?
Post by: DrEvil on November 01, 2007, 03:05:22 am
That sounds great.
Title: Less formats vs less dependencies ?
Post by: dabo on November 01, 2007, 12:17:10 pm
Again, will we only loose support for some uncommon image formats? or will we also loose some image manipulating functions?
Title: Less formats vs less dependencies ?
Post by: Laurent on November 01, 2007, 12:30:46 pm
No, just formats. I'll change only the load / save code.
Title: Less formats vs less dependencies ?
Post by: DrEvil on November 01, 2007, 02:39:38 pm
Also get loading from memory too as part of it, nice. Can load from archives and such with it. I converted my local copy of SFML to use SOIL and it was very simple.
Title: Less formats vs less dependencies ?
Post by: CareBear on November 01, 2007, 09:13:16 pm
TGA and/or PNG.
Both support alpha channels, are free, lossless and easy.
The last one supports better compression (zlib).

Nothing more, because at least one of them should fit any needs.
BMP and JPG are uninteresting because they don't have an alpha channel. Something about JPG, who wants textures with artifacts?

About dds... well... i can't say much about it, but it seems good.
Title: Less formats vs less dependencies ?
Post by: PM on November 02, 2007, 12:15:48 am
JPEG is a good format for saving screen-shots (for games that have this kind of functionality).
Title: Less formats vs less dependencies ?
Post by: CareBear on November 02, 2007, 01:01:46 pm
Mh, i dislike games which only produce jpeg screenshots. Because often the red becomes very blurry.
Title: Less formats vs less dependencies ?
Post by: PM on November 02, 2007, 01:46:59 pm
I'm not arguing about the quality. But I'm currently working on one game (it was started WAY before SFML first release, so it doesn't use it) and it's a network game and people often want to post screen-shots (their achievements) on the forum. JPEG are the perfect formats for that.

You have to keep in mind, that some of your game fans might not be IT professionals, so to speak. They might not know how to manually convert picture formats and/or shrink images. So a user-friendly way of doing things is to create screen-shots of the appropriate size and format for the web.

One might argue, that PNG is just as good for the web as is JPEG. However, some older Internet browsers have crappy support for PNG, and unfortunately, we have to keep that in mind.
Title: Less formats vs less dependencies ?
Post by: DrEvil on November 02, 2007, 02:34:35 pm
SOIL supports plenty of the major formats, so I hope it gets to replace devil in SFML. Because I am impatient I went ahead and replaced devil with it in my local copy of the code and it was very simple. Now I'm free of external dependencies(I'm not using the sound libraries atm).
Title: Less formats vs less dependencies ?
Post by: zarka on November 04, 2007, 02:06:20 pm
PNG is realy the only format im using so im all for a change :)
Title: Less formats vs less dependencies ?
Post by: herc on November 07, 2007, 02:12:56 pm
did you know that you can get similiar, and sometimes better compression if you use tga files and compress them using b2zip library?

i store all my textures in tga and put them in a bz2 compressed archive.

bzip2 is completely ansi-c and can be easily compiled and statically linked. i even managed to throw all bzip2 c files into one singe c-file, so i only need to add that single c-file to my project.


about openAL. you can make a static linkable version of that one, too. you will loose native hardware acceleration, though. but if you are fine with openAL generic software and hardware modes, you can just link it statically (with some minor modifications to the source code)



about less image formats: strong vote for NO EXTERNAL DEPENDENCIES!!! if possible.

and memory loading is an absolute must have! i load all stuff from a compressed archive, and do not want to be forced to first write stuff to harddisk to be able to load it. everything in SFML should be also loadable from a memory location. very important!!

i have looked into the stb_image.c  source - it allows loading from memory. but it has an ugly c interface. so combining stb_image with SFML sounds like the perfect idea!! cant wait to see a new SFML released!


p.s. really nice project. i love the simplicity of the network stuff. its so nice that i now finally think i will try out to add networking to my little game.
Title: Less formats vs less dependencies ?
Post by: dunce on November 19, 2007, 08:25:35 am
Finally I got rid of all dll dependencies except OpenAl distribution pack. LGPL-ed libs that required dynamic linking have gone. I use static linking for everything including VC8 runtime libraries. From now on I can distribute just an exe file and game assets.
Title: Less formats vs less dependencies ?
Post by: Lord Delvin on November 19, 2007, 09:16:30 am
Quote from: "dunce"
From now on I can distribute just an exe file and game assets.

You could make a package, hardcode it and then load it from memory :twisted: