I would like to have some information about material because I have many problem with it and I didn't found many documentation on this subject (correct me if I 'm wrong)
1) First, I have a custom scene node and I would like to make it transparent belong the vertex alpha value, so I choose the "EMT_TRANSPARENT_VERTEX_ALPHA" material type and it works BUT my problem is that writing into the Zbuffer is disable and there is "problem of deep" between my nodes. I'll try to set "true" the "Material.Zbuffer" and "Material.ZWriteEnable" but it doesn't work ....
2) I have a mesh that I made on blender and that I export into ".obj". It is loaded correctly and I would like to make it transparent and give him a color. How can I made that.
3) Finally, One side of the skybox (I picked it from the example) is blank (white). I have checked the path. I don't understand because the skybox has already works. Maybe, it's a side effect.
Thanks in advance...
Material questions
thanks for your reply and sorry to answer so late but I have no time this last days.
1) I register the node as transparent but I have the same problem...
2) It works fine !! but I got a problem when I quit the program. Something like a segmentation fault. It comes from here because It's not happen when I cut the following code source :
I have no error when I use a IAnimatedMesh but my mesh isn't animate so I would like to use a IMesh. I think it comes from a dropped node or something but in this case. Do I have to drop the IMesh arrow ?
3) Irrlicht says it has loaded all oh the needed texture. I seems to be a bug, isn't it ?
1) I register the node as transparent but I have the same problem...
Code: Select all
void TrajectoireSceneNode::OnPreRender()
{
if (IsVisible)
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
// SceneManager->registerNodeForRendering(this);
ISceneNode::OnPreRender();
}
Code: Select all
scene::IMesh* arrow = device->getSceneManager()->getMesh("./ressources/arrow.obj")->getMesh(1);
if (!arrow)
{
printf("incorrect filename\n");
return 1;
}
smgr->getMeshManipulator()->setVertexColors(arrow,video::SColor(127,0,255,0));
node = device->getSceneManager()->addMeshSceneNode(arrow);
//arrow->drop();
node->setName((const wchar_t*)"arrow" );
// set default material properties
node->setPosition(core::vector3df(2900,1400,3200));
node->setRotation(core::vector3df(-90,0,0));
node->setScale(core::vector3df(100,100,100));
//node->setMaterialType(video::EMT_SOLID);
node->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
node->setMaterialFlag(video::EMF_LIGHTING, false);
3) Irrlicht says it has loaded all oh the needed texture. I seems to be a bug, isn't it ?
To fix #2, do this -
Then when you are done with both meshes, call drop on the mainArrowMesh.
Or, you can use the createMeshCopy function of CMeshManipulator to create a copy of the getMesh(1).
Code: Select all
scene::IAnimatedMesh* mainArrowMesh = device->getSceneManager()->getMesh("./ressources/arrow.obj");
scene::IMesh* subArrowMesh = mainArrowMesh->getMesh(1);
mainArrowMesh->grab();
Or, you can use the createMeshCopy function of CMeshManipulator to create a copy of the getMesh(1).

Thanks !! it works but I don't understand why. Why sould have to grab the IAnimatedMesh object because I never drop it by myself. I did not understand well the mechanism of the drop and grab methods and the methods description into the API is not enough for me. I would like to know exactly when and where I have to drop and grab my object.
Is there a tutorial or wiki stuff to a newbie like me who don't want have memory leaks...
Is there a tutorial or wiki stuff to a newbie like me who don't want have memory leaks...