Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: z64555 on October 17, 2015, 12:14:25 pm

Title: PCS2 DevIL Migration?
Post by: z64555 on October 17, 2015, 12:14:25 pm
After a short discussion between me and m|m on IRC, we've decided it might be a good idea to switch to using a different image library than DevIL, since it hasn't been well maintained has proven to be a bit difficult to get newer versions of MSVS situated to build it. There has been some work done on github for DevIL to try to get cmake rolling on it, so things may change for the better in the coming months.

What are some possible alternatives to DevIL?

Aside from image format decryption and loading, I'm not sure of what the needs of PCS2 is regarding image formats at this point in time, so a second question would be: What are the needs of PCS2 regarding image formats?

Ideally, the image library that we end up choosing will support cmake, or otherwise have a number of packages available for download that developers can choose to suit their particular build system.
Title: Re: PCS2 DevIL Migration?
Post by: The E on October 17, 2015, 12:21:43 pm
PCS2 needs to read the most common texture formats. Right now, these would be DDS, TGA and PNG. Everything else, I feel, can be safely ignored.
Title: Re: PCS2 DevIL Migration?
Post by: Axem on October 17, 2015, 12:26:43 pm
No more love for 8-bit paletted PCX files?  :(

The world has truly changed.
Title: Re: PCS2 DevIL Migration?
Post by: The E on October 17, 2015, 12:52:26 pm
I guess we'd need those too for retail compatibility.
Title: Re: PCS2 DevIL Migration?
Post by: headdie on October 17, 2015, 04:29:34 pm
I guess we'd need those too for retail compatibility.

Yer FSPort will throw a ****storm if they cant do retail compattible
Title: Re: PCS2 DevIL Migration?
Post by: z64555 on October 17, 2015, 11:05:04 pm
We can use libpng easily enough, and I've got specs to and experience with .PCX so those two formats shouldn't be a hassle.

Just now grabbed the spec of TGA, shouldn't be too difficult to implement, but a lib that's maintained by smarter folk than I would be preferable. :)

So, that just leaves DDS. Doesn't OpenGL provide some sort of import lib for that?

[EDIT]I've been eyeing up the stb library (which is C) and one of its derivatives Cimg (which is C++ templates) and they seem like they're hassle free-ish at a first glance.
Title: Re: PCS2 DevIL Migration?
Post by: m!m on October 18, 2015, 04:47:33 am
I looked for a DDS reading library before but I couldn't find anything good so I wrote one myself: https://github.com/asarium/libddsimg
Title: Re: PCS2 DevIL Migration?
Post by: z64555 on October 18, 2015, 04:52:29 am
What about Nvidia's texture tools? https://code.google.com/p/nvidia-texture-tools/ (https://code.google.com/p/nvidia-texture-tools/)
Title: Re: PCS2 DevIL Migration?
Post by: Darkmage on October 18, 2015, 04:54:49 am
Why not libSDL_Image?
Title: Re: PCS2 DevIL Migration?
Post by: z64555 on November 18, 2015, 02:36:05 pm
:bump:

So we're getting back to PCS2. Has anybody checked on the image libraries lately? I got sidetracked by life...  :nervous:
Title: Re: PCS2 DevIL Migration?
Post by: z64555 on November 19, 2015, 04:27:39 am
Ok, so. I'm going to try giving wxWidget's libraries a shot, since it already comes with loaders that'll cover the bulk of the required image types, excluding DDS. I'm thinking we'll give m|m's loader a chance once the other formats can load up readily, although I'm not quite sure at this moment how that'll end up looking like when it comes time to shoehorn it in.

Texture loading process is basically:
1. Find texture. It's either a loose texture or it's inside of a VP somewhere.
2. Import the texture into a buffer.
3. Bind the buffered texture to OpenGL and save its index.
Title: Re: PCS2 DevIL Migration?
Post by: m!m on November 19, 2015, 05:03:37 am
My DDS loader currently only support the compressed formats but not the raw RGB formats. If that's a problem then I could try adding that capability.
Title: Re: PCS2 DevIL Migration?
Post by: Bobboau on January 09, 2016, 09:01:06 pm
because I don't think anyone else mentioned it, why not ResIL (https://github.com/ScaledLizard/ResIL)? a fork of DevIL that has the added feature of being actively maintained!
should just be a drop in replacement I would think.
Title: Re: PCS2 DevIL Migration?
Post by: m!m on January 16, 2016, 08:05:02 am
I have been working on a standalone C image loader library and so far it's working pretty well: https://github.com/asarium/imageloader

Currently it has support for DDS, PNG and the formats supported by stb_image (which includes TGA and JPEG) but it is plugin-based so a PCX plugin can be added later.

The code that handles texture uploads seems to be reasonable easy to work with. I'll try to convert it to use my library.
Title: Re: PCS2 DevIL Migration?
Post by: z64555 on January 16, 2016, 10:24:47 am
The PCX spec is real easy to do, I could make a plugin for ya.
Title: Re: PCS2 DevIL Migration?
Post by: m!m on January 18, 2016, 06:27:01 am
I migrated the PCS2 build system to CMake which enables me to directly integrate imageloader and also unifies the build system across all platforms.
After doing that I replaced the DevIL loading code with code that uses imageloader and so far everything is working great:
(http://i.imgur.com/2YFZHha.png)