Only the first object is transparent

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
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Only the first object is transparent

Post by saigumi »

cd I've seen this strange problem. My first object gets created and textured fine. The second instance to use the same texture causes the transprency to be dropped.

Any Ideas?

Code: Select all

	irr::video::SColor transparent = irr::video::SColor(0, 255, 0, 255);
	node = environment->smgr->addTestSceneNode(1,0,-1,Start);
	irr::video::ITexture* image1 = environment->driver->getTexture("explosion.bmp");
	environment->smgr->getVideoDriver()->makeColorKeyTexture(image1, transparent);
	node->setMaterialTexture(0,image1);
	node->getMaterial(0).BackfaceCulling = false; //will make all polygoons to be doublesided 
	node->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL); 
First one:
Image

All others:
Image
Crud, how do I do this again?
Guest

Post by Guest »

which driver?
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

DirectX 8 + 9.
OpenGL does it right, but the material that isn't transparent is very faded.
Software doesn't do transparency at all.
Crud, how do I do this again?
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

saigumi wrote: OpenGL does it right, but the material that isn't transparent is very faded.
Is it faded for all of them under OGL, or just anything past the first?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

All of them are faded when I use the OpenGL driver. I've been trying to dig through why but haven't found anything yet.
Crud, how do I do this again?
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Found the problem.

Each time I create the texture for each object, I applied the color key. Since the color key had already been applied, the color key transparency gets borked and fills in black.

I fixed it by loading all my textures once and applying the color key. Then, the each object just loads the texture out of memory.
Crud, how do I do this again?
Post Reply