• Advertisement
Sign in to follow this  

SOIL: new lightweight image loading lib

This topic is 2792 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quote:
Original post by syndicatedragon
If anyone is interested, I've packaged the SOIL library as a MacOSX framework. Looking forward to an update, especially size reporting!


I would like that. I am still using a beta version of the library, and it has not failed me yet, however I had to make some changes to make it compile on GCC. An OS X framework would be great.

Share this post


Link to post
Share on other sites
Advertisement
Here's a link. It's built as a universal binary, and as "private" framework i.e. it's intended to be copied into the app bundle.

I only have 10.5 machines so I don't know if it works with 10.4. It *should*, but I haven't tested it.

http://shodanproductions.com/misc/SOIL/SOIL_framework_20071110.dmg

Share this post


Link to post
Share on other sites
Quote:
Original post by syndicatedragon
... size reporting!
What is size reporting? Like size in bytes?

Anyways great library, and quite efficient I may add. =]

Share this post


Link to post
Share on other sites
nice library you have, i managed to fix the problem with loading the texture in soil.

Share this post


Link to post
Share on other sites
Quote:
Original post by JMNightmare
Quote:
Original post by syndicatedragon
... size reporting!
What is size reporting? Like size in bytes?

Sometimes SOIL resizes the image on load (if the card needs a power-of-2 size, for example). There have been requests for SOIL to report the original size of the texture as it was loaded, before any manipulation (and/or an easy way to just determine what was the size of the texture that was loaded). I've had a pretty busy few months, but I'm getting some free time again, so development of SOIL is back on. Thanks for your patience everybody!

Share this post


Link to post
Share on other sites
Quote:
Original post by muster
nice library you have, i managed to fix the problem with loading the texture in soil.

Thanks! Glad you got it working!

Share this post


Link to post
Share on other sites
Hey,

Thank you for an awesome library, first of all. Unfortunately for me, it seems that no matter what I tweak, I invariably receive the following errors:

1>libSOIL.a(stb_image_aug.o) : error LNK2019: unresolved external symbol __alloca referenced in function _stbi_zlib_decode_noheader_buffer
1>libSOIL.a(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2

I know I am most likely missing a .lib file but after extensive searching online I have found no resolutions to this problem. Any help would be greatly appreciated.

Thank you in advance,
Ezra

Share this post


Link to post
Share on other sites
I had the same linking errors trying to use libSOIL.a with VC9. I fixed it by builiding a new SOIL.lib from the included VC9 project. This also increased the size of the library x 4.

Share this post


Link to post
Share on other sites
I've modified soil to support saving uncompressed dds images and fixed bugs with it not being able to distinguish with ARGB8888 and ABGR8888 in its saving and loading of uncompressed dds files.

Additionally I have added SOIL_get_imageinfo_fromfile( const char* filename, SOIL_imageinfo* imageInfo ) which is akin to direct3d's D3DXGetImageInfoFromFile. It allows you to extract the size, format, and other properties of a file without actually loading the entire thing. I needed this because fully parsing an image (png's in particular) just to get some dimension info was too slow for my needs.

Due to being busy with work and such, I'm going to give myself a week to clean up my changes and I'll submit them.

Share this post


Link to post
Share on other sites
I have the same problem as EzraBC.
Strange, because last time I used it I had no such problem.
Are we doing something wrong?

I can't use the .sln file to build the library myself because my MSVC version is too old (2005).

Share this post


Link to post
Share on other sites
Hi, all.

As you know, SOIL uses stb_image internally for most if the loading/saving functionality. In recent times Sean updated his stb_image code to be thread-safe. In doing so he apparently made a bunch of changes that are compiler specific. I didn't notice at the time, and I was only distributing a precompiled lib made with MinGW. It used to work on all compilers, but now that stb_image uses compiler specific functions, SOIL now needs to be compiled on each target compiler.

SOIL ships with a number of project files: Code::Blocks, a makefile for GCC (Linux and Mac and MSYS folks), Visual Studio 6, 2003, 2005, 2008 (in the VC6, 7.1, 8, 9 directories, respectively). So everybody should be able to build it on their dev machine, in theory. Is this a problem? Should I just have N compiled library files ready to go in the zip?

Jonathan

Share this post


Link to post
Share on other sites
Loving it. Thanks!
Thanks for giving us all the different project files to make the compile process ALOT easier. Since I'm a total noob with compiling libraries and I almost 99.9% of the time won't get the libraries to compile for the stupidest reasons but this one I did since I was supplied with everything. Thanks!

So far the librarys been awesome :)

Share this post


Link to post
Share on other sites
This library is all kinds of badass. It was a pleasant surprise when I didn't even have to change a few of my functions to transition from my loaders to SOIL. Maybe that's not as unlikely as it seemed to me at the time...at any rate: Thank you very much, lonesock. You rock!

Share this post


Link to post
Share on other sites
hi

i ve got problem with soil for a 2d opengl engine

rendering quality is bad especially when i ve got color gradients on my textures.

dont know why, but I m sure that the problem is related to soil options , because when i use my own LoadBitmap code , i dont get this problem

http://www.vm-games.com/imgs/in_jpg.jpg

http://www.vm-games.com/imgs/in_engine.jpg


i cant explain because i m using the same filtering (linear) with both soil code and load bitmap code

any ideas?

Share this post


Link to post
Share on other sites
Quote:
Original post by velk
hi

i ve got problem with soil for a 2d opengl engine

rendering quality is bad especially when i ve got color gradients on my textures.

dont know why, but I m sure that the problem is related to soil options , because when i use my own LoadBitmap code , i dont get this problem

http://www.vm-games.com/imgs/in_jpg.jpg

http://www.vm-games.com/imgs/in_engine.jpg


i cant explain because i m using the same filtering (linear) with both soil code and load bitmap code

any ideas?

Any chance you could post the code you're using to load the image via SOIL? Is it possible you have DXT compression enabled? Depending on the resolution of the original image and the options you've supplied to SOIL, SOIL may be upsizing the image to a power of two, which could lead to stair-stepping like that over long gradients.

Share this post


Link to post
Share on other sites
Hi,

I'm also having these same linker errors when I try to use SOIL:

1>libSOIL.a(stb_image_aug.o) : error LNK2019: unresolved external symbol __alloca referenced in function _stbi_zlib_decode_noheader_buffer
1>libSOIL.a(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2

MatthewBurk says it was fixed by "building a new SOIL.lib". I wonder if you could go into a little more detail? (I'm kinda new to visual).

Share this post


Link to post
Share on other sites
Actually, it fine now. Yeah, its the SOIL.lib file in the project that's provided. Include that and it is fixed.

Share this post


Link to post
Share on other sites
Hey, so I was wondering if anyone could help with an issue I have compiling a game in cygwin.

Previously I wrote my own image loader for bitmaps, however, bitmaps kinda sucked in terms of size, so I wanted something to load PNGs. I decided to implement SOIL and it's worked perfectly under Mac OS X. However, when I attempt to compile the SOIL lib and then my game, I get the following errors due to undefined references:


$ make
g++ -Wall -o game_name.exe -I/usr/include/opengl -I/usr/include/w32api
-I./Simple\ OpenGL\ Image\ Library/src drawable.cpp texture.cpp player.cpp
character.cpp main.cpp map.cpp collideable.cpp state.cpp -L/usr/lib/w32api
-L./Simple\ OpenGL\ Image\ Library/lib -lglut32 -lglu32 -lopengl32 -lSOIL

./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x253): undefined reference to `_glReadPixels'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x34a): undefined reference to `_glGetString'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x37c): undefined reference to `_glGetString'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x3ba): undefined reference to `_glGetString'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x3ed): undefined reference to `_glGetString'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x40e): undefined reference to `_glGetString'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x45a): more undefined references to `_glGetString' follow
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x4cb): undefined reference to `_glXGetProcAddressARB'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x8af): undefined reference to `_glTexImage2D'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x9cd): undefined reference to `_glTexImage2D'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xa23): undefined reference to `_glDeleteTextures'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xaa3): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xac3): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xaed): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xb0d): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xb2d): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xc2b): undefined reference to `_glGenTextures'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xc65): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xc85): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xd09): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0xfb6): undefined reference to `_glGetIntegerv'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1305): undefined reference to `_glTexImage2D'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1465): undefined reference to `_glTexImage2D'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x14ad): undefined reference to `_glTexImage2D'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x14d4): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x14f1): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x151e): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1531): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x157a): undefined reference to `_glTexParameteri'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1594): more undefined references to `_glTexParameteri' follow
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1611): undefined reference to `_glGenTextures'
./Simple OpenGL Image Library/lib/libSOIL.a(SOIL.o):SOIL.c:(.text+0x1748): undefined reference to `_glTexImage2D'
collect2: ld returned 1 exit status
make: *** [flock_you.exe] Error 1





Edit: removed warnings related to my code

Share this post


Link to post
Share on other sites
HI,

1) Congratulations on necro'ing a thread from 3 years ago...

2) gcc (including g++) on OS X uses frameworks, which contain headers and object code in one package. I dont know the full details, but there are various things for you to find online. Mostly they recommend g++ <your various files> -framework OpenGL -framework glut or similar.


Share this post


Link to post
Share on other sites
I probably should have rewritten the last line as:

However, when I attempt to compile the SOIL lib and then my game in cygwin, I get the following errors due to undefined references:

This is what compiling on Mac OS X looks like:

$ make
g++ -Wall -o game_name -I./Simple\ OpenGL\ Image\ Library/src drawable.cpp
texture.cpp player.cpp character.cpp main.cpp map.cpp collideable.cpp state.cpp
-L./Simple\ OpenGL\ Image\ Library/lib -framework OpenGL -framework GLUT -framework
CoreFoundation -lSOIL
$


It's very beautiful. But when compiling under cygwin as in my previous post, I seem to get a lot of undefined references to OpenGL library functions. My original code also uses some of the same function, but has no issue compiling them. What do I have to do so that it won't complain about the OpenGL code inside of the SOIL library?

I originally tried linking opengl when recompiling the library, but it said I couldn't link in OpenGL when making a static library.

Share this post


Link to post
Share on other sites
So I managed to remove a whole bunch of the undefined references by changing the order in which I called the static libraries, e.g.:


$ make
g++ -Wall -o game_name.exe -I/usr/include/opengl -I/usr/include/w32api
-I./Simple\ OpenGL\ Image\ Library/src drawable.cpp texture.cpp player.cpp
character.cpp main.cpp map.cpp collideable.cpp state.cpp -L/usr/lib/w32api
-L./Simple\ OpenGL\ Image\ Library/lib -lSOIL -lglut32 -lglu32 -lopengl32

./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0x6c1): undefined reference to `__assert'
./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0x939): undefined reference to `__assert'
./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0xc7a): undefined reference to `__assert'
./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0x2d44): undefined reference to `__assert'
./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0x2ee6): undefined reference to `__assert'
./Simple OpenGL Image Library/lib/libSOIL.a(stb_image_aug.o):stb_image_aug.c:(.text+0x2fb5): more undefined references to `__assert' follow



Any ideas as to how to remove these?

Share this post


Link to post
Share on other sites
Figured everything out now. In one of the stb files, you have to add a #define NDEBUG before the line #include <assert.h> so that asserts are turned off. So to recap, if you want to use SOIL in a project that's going to be compiled in cygwin, you need to make sure when you compile that the -lSOIL flag comes before the -lopengl32 flag and that you define NDEBUG before assert.h is included. Hope this helps anyone else who decides to use cygwin to compile.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement