SOIL: new lightweight image loading lib

Started by
129 comments, last by GenPFault 13 years, 10 months ago
Yes, it worked :). Sorry for not having answered you sooner :D
Advertisement
I've ported your library to C# (using Mono). I've only tested what was in you original C example file, and it all seems to work fine, so I suspect everything is fine. If there are any bugs I can be contacted here on gamedev.

I have no place to permanently upload this, so if this link dies please contact me :-)
Released under public domain.

Thanks for such an awesome image loading library lonesock!!

Soil#: http://a-nub.pspsc.com/stuff/Soil%23.zip
mirror: http://www.sendspace.com/file/ki6kcs

Btw, compiled on Mac OS X!

[Edited by - bronxbomber92 on February 12, 2008 9:45:12 PM]
Awesome library, I'm definitely going to replace SDL_img with it. Thanks!
Quote:Original post by bronxbomber92
Btw, compiled on Mac OS X!

Good to hear - let me know if there were any problems.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Love this library.

One thing that i'm sorely missing is configuring texture wrap modes aside from repeating. Mainly forcing a certain border color. I use that a lot.

An easy way of adding support for that could be to have a static float4 stored in SOIL that the user could change with like
SOIL_Set_Border_Color(float4);
and then have a flag such as SOIL_FLAG_BORDER_COLOR for the loading function that would use soil's static border var as a color.


____________________________Bjarni Arnasonbjarni.us
Hi, everyone. Sorry for the long silence. I'm expecting to be less busy in about a week, so I'll be making some updates, including a few of the requests (such as the ever popular "How big was the texture you just loaded?" [8^) and updating to the latest stb_image, etc.

Thanks for your patience.
I'm still in that stubborn frame of mind where I want to write every last piece of my game myself but your little library there has so nearly tempted to change my ways. Even if I don't use it, you seem to have done an excellent job with the thing. Top stuff sir, your rate++ is in the post.
!SOLVED!

I've just been trying to use SOIL and have been totally unsuccessful. Here are the problems I've encountered, so far.

I'm using C++ in VS 2005.

1. Using libSoil.a

(added a reference to libSoil.a and '#include "SOIL.h"')

Debug mode compiles but when run raises Unhandled exception and drops out to strstr.asm.

Build mode compiles but when run raises Unhandled exception

-=- -=- -=- -=- -=-


2. Including all the files

Debug mode acts as above, the error occurs in
int query_NPOT_capability( void )  if(      (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),        "GL_ARB_texture_non_power_of_two" ) )      )
Build mode compiles but when run raises Unhandled exception

-=- -=- -=- -=- -=-


3. Compiling the library myself

had to add
  #ifdef _MSC_VER  #define inline __inline  #endif
to fix >>> error C2054: expected '(' to follow 'inline' <<<

the compiled library has the same problems as 1. above.


-=- -=- -=- -=- -=-

I also tried to compile and run test_SOIL.cpp from the src directory, but looking at the many, many rem's I'm guessing that this wasn't meant for release...

========================================================

All sorted.

It transpires that glGetString requires an OpenGL context to work, it may be good form to add a check to query_NPOT_capability to make sure it fails gracefully.

I'm pleased I sorted this one out since I like the fact that SOIL is a small-ish lib, and it's always pleasant to find why code is failing.

I started playing with FreeImage, which worked right off the bat, but a dll, lib and .h? C'mon, like that's too much work dude. So, now I can "go back" to playing with dirt... er, SOIL, I mean... Freudian slip?

HTH

[Edited by - Amnesiac5 on May 8, 2008 8:31:03 AM]
Constipation is the thief of time.Diaorrhea waits for no man.
hi!

I have a strange problem, sometimes my textures show a strange horzontal line at the bottom and another vertical one at the right. And sometimes it is working well.

Does anyone have any idea?


Code:
// model
m_plano = glGenLists(1);
glNewList(m_plano,GL_COMPILE);

glBegin (GL_QUADS);
// vertice 1
glTexCoord2f (0.0, 0.0);
glVertex3f (0.0, 0.0, 0.0);

// vertice 2
glTexCoord2f (0.0, 1.0);
glVertex3f (0.0, -1.0, 0.0);

// vertice 3
glTexCoord2f (1.0, 1.0);
glVertex3f (1.0, -1.0, 0.0);

// vertice 4
glTexCoord2f (1.0, 0.0);
glVertex3f (1.0, 0.0, 0.0);

glEnd ();
glEndList();


// load
tex_2d=SOIL_load_OGL_texture(nombre_archivo, SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID, 0);


Thanks a lot for your help.

Picture:

I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
If anyone is interested, I've packaged the SOIL library as a MacOSX framework. Looking forward to an update, especially size reporting!

This topic is closed to new replies.

Advertisement