Today I switched my texture loader over from using ImageIO.read() to using the DevIL features. I find that the images returned from DevIL are highly saturated for some unknown reason. Is this a known problem?
Here are the comparison screenshots:
http://statezero.net/dev/sshot_imageio.png
http://statezero.net/dev/sshot_devil.png
Here is the dirt texture as a reference
http://statezero.net/dev/dirt.png
Here is the super-simple code I use to load:
protected boolean loadInternal(String filename)
{
IntBuffer images = BufferUtils.createIntBuffer(1);
IL.ilGenImages(images);
images.rewind();
IL.ilBindImage(images.get());
boolean result = IL.ilLoadImage(filename);
if (result == false)
{
Warning.emit("DataSourceTextureObject.loadFromStream() failed to create image from InputStream");
return false;
}
setDepth((short) IL.ilGetInteger(IL.IL_IMAGE_BPP));
setWidth((short) IL.ilGetInteger(IL.IL_IMAGE_WIDTH));
setHeight((short) IL.ilGetInteger(IL.IL_IMAGE_HEIGHT));
ILU.iluFlipImage();
int numPixels = getWidth() * getHeight();
ByteBuffer data = BufferUtils.createByteBuffer(numPixels * 4);
IL.ilCopyPixels(0, 0, 0, getWidth(), getHeight(), 1, IL.IL_RGBA, IL.IL_BYTE, data);
data.rewind();
setPixels(data);
return true;
}
Thanks!
