Page 1 of 1

createImageFromData() and addTexture()

Posted: Thu May 10, 2007 6:18 pm
by bigfish
Hi all,

I'm trying to create a texture in memory and apply it to some geometry. I'm actually using Irrlicht.NET CP but I've added wrappers for the createImageFromData() and addTexture() functions, which seem to be working. I posted some questions about that here:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=21236

Now my problem is that when I call addTexure(), the process just hangs. Since I think the wrapper is okay, I'm guessing the problem lies in the native Irrlicht library. You can see the way I'm using it in that post I linked to. Does anyone have any thoughts about what could be going on? Am I using it correctly? Has anybody here even tried to use that stuff?

Thanks,
bigfish

Posted: Wed May 16, 2007 8:31 am
by mamba

Code: Select all

	char test[256*256*3] ;
	for(int i = 0; i < 256 * 256 * 3; i += 3)
	{
		test[i] = (char)0;
		test[i + 1] = (char)0;
		test[i + 2] = (char)255;
	}
	core::dimension2d<s32> ds = core::dimension2d<s32>(256, 256);
	void * data = &test[0];
	video::IImage * iim = driver->createImageFromData(irr::video::ECOLOR_FORMAT::ECF_R8G8B8,ds, data,false,false);
	
	video::ITexture* images = driver->addTexture("demo",iim);
is working in C++ with different ECOLOR formats
I tested R8G8B8 , A8R8G8B8

But I also get a crash with the NETCP wrapper.
Hopefully I find the reason why the wrapper does not work.

mamba

Posted: Wed May 16, 2007 9:04 am
by hybrid
A8R8G8B8 won't reliably work with the code above because you create too few bytes (this color format has size*4 bytes!). But the rest is expected to work under C++. I don't know anything about .Net, though.

Posted: Wed May 16, 2007 11:31 am
by mamba
of course I changed the right lines :D

Posted: Wed May 16, 2007 11:42 am
by mamba

Code: Select all

            Image iimg = driver.CreateImageFromFile("../../medias/rockwall.bmp");
            Texture tex = driver.AddTexture("demo", iimg);
got this running in irrnetcp - I will post more in this forum!

Here is one question concerning wrapping.

How is it possible to wrapp overloaded functions without
defining several different EXPORT names for each overloading function???

thanks
mamba