createImageFromData() and addTexture()

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
bigfish
Posts: 19
Joined: Fri Mar 23, 2007 6:18 pm

createImageFromData() and addTexture()

Post 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
mamba
Posts: 6
Joined: Mon Mar 05, 2007 12:51 pm

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

Post 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.
mamba
Posts: 6
Joined: Mon Mar 05, 2007 12:51 pm

Post by mamba »

of course I changed the right lines :D
mamba
Posts: 6
Joined: Mon Mar 05, 2007 12:51 pm

Post 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
Post Reply