Cannot access CImage in external meshloader

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
L o
Posts: 44
Joined: Sun Mar 29, 2009 2:53 pm

Cannot access CImage in external meshloader

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you should create the image via the driver methods (createImage...) and use the interface provided by IImage.
L o
Posts: 44
Joined: Sun Mar 29, 2009 2:53 pm

Post 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?
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

Check out IVideoDriver::createImageFromData. It does just what you want to do: creates an IImage from an array of pixels.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
L o
Posts: 44
Joined: Sun Mar 29, 2009 2:53 pm

Post by L o »

Good idea :) Thank you so much!
Post Reply