Page 1 of 1

Cannot access CImage in external meshloader

Posted: Sat May 15, 2010 8:09 pm
by L o
Hi,

I need to access CImage in my external meshloader to build a texture of it. However, CImage is not in the Irrlicht include directory, but only in the internal sources. I can still compile it including the inner sources, and it does link on Linux. However, that should not be the way it is done? Moreover, I get linker errors on Windows.

Can someone please help me? I need either a way to access C Image on Windows or (I'd prefer that) an alternative to using CImage (without inheriting IImage myself).

Thanks,
Lo

Posted: Sat May 15, 2010 10:55 pm
by hybrid
Yes, you should create the image via the driver methods (createImage...) and use the interface provided by IImage.

Posted: Sun May 16, 2010 10:24 am
by L o
Yeah, I know what you mean, but I have the data as an array of pixels. Now, As you say it, I will have to write those into a file (where I'll need to give them a header and all that information), to then load them from this file again into an IImage*? This would cause a large loss in runtime: imagine creating one file for each of those 1500 lightmaps...

Anyways, if this is the case, which file format is the easiest to store an array of 16bit-pixels? TGA? BMP?

Posted: Sun May 16, 2010 2:28 pm
by slavik262
Check out IVideoDriver::createImageFromData. It does just what you want to do: creates an IImage from an array of pixels.

Posted: Sun May 16, 2010 3:44 pm
by hybrid
Yup, if the data is already in a proper data format, just create the image from the raw data. Otherwise create an empty image (also with some createImage... call) and fill the data in while converting it.

Posted: Sun May 16, 2010 3:48 pm
by L o
Good idea :) Thank you so much!