Changing MaterialType does not work

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
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Changing MaterialType does not work

Post by pippy3 »

I want to change

Code: Select all

			mesh->getMesh()->getMesh(0)->getMeshBuffer (0)->getMaterial ().MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
to

Code: Select all

			mesh->getMesh()->getMesh(0)->getMeshBuffer (0)->getMaterial ().MaterialType = video::EMT_SOLID;
But it stays the same after I modify it. Others have had this issue too.

Is there a work around, or am I doing something stupid?
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

have you tried passing n (mateiral index) as the param for get material?
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

ChaiRuiPeng wrote:have you tried passing n (mateiral index) as the param for get material?
ha! didn't expect for a reply that quick that fixed the problem. Yes it did :)

Code: Select all

if(!seethrough){
	mesh->getMaterial (0).MaterialType = video::EMT_SOLID;
	mesh->getMaterial (1).MaterialType = video::EMT_SOLID;
} else {
	mesh->getMaterial (0).MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
	mesh->getMaterial (1).MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
}
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

welcome.

remember to always read the API for any little params you are passing wrong/not passing at all.

and also check for const stuff.. to make sure you are passing const correct params or getting the right references you need.
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

You can also alter the material type at ISceneNode level that overrides the meshbuffer materials and uses a single call that does all the process :)

http://irrlicht.sourceforge.net/docu/cl ... f5ed8446de
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply