File format support alpha channel?
Posted: Sun Feb 15, 2015 11:36 am
Follows are my code example
dwarf.x alpha channel in win32 OpenGL is Good
but in ios android OGLES-1 not good
{ninja.b3d} can show transparent alpha in OGLES-1 and use MyAlpha to adjust high low
why the {dwarf.x} can not show transparent effect in OGLES-1?
1.
is the file format not support alpha channel for .x in OGLES-1?
2.
what formats support?
///////////////
//mesh = smgr->getMesh( (GetBaseAppPath()+"game/ninja.b3d").c_str() );
mesh = smgr->getMesh( (GetBaseAppPath()+"game/dwarf.x").c_str() );
node = smgr->addAnimatedMeshSceneNode( mesh );
//////////////////////////////texture/////////////////////////////////////////////////
node->setMaterialTexture( 0, driver->getTexture((GetBaseAppPath()+"game/nskinrd.jpg").c_str()) );
node->setMaterialFlag(EMF_LIGHTING, true);
node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
u32 MyAlpha = 100;
u32 MaterialCount = node->getMaterialCount();
for(u32 i=0; i<MaterialCount; i++)
{
video::SMaterial& tex_mat = node->getMaterial(i);
tex_mat.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
tex_mat.MaterialTypeParam = 0.1;
tex_mat.MaterialTypeParam2 = 0.1;
tex_mat.AmbientColor.setAlpha(MyAlpha);
tex_mat.DiffuseColor.setAlpha(MyAlpha);
tex_mat.SpecularColor.setAlpha(MyAlpha);
tex_mat.EmissiveColor.setAlpha(MyAlpha);
}
//use it or not by platform
for(u32 i=0; i<mesh->getMeshBufferCount(); i++)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
for(u32 j=0; j<buffer->getVertexCount(); j++)
{
//vertex[j].Color = video::SColor(MyAlpha,255,255,255);
vertex[j].Color.setAlpha(MyAlpha);
}
}
dwarf.x alpha channel in win32 OpenGL is Good
but in ios android OGLES-1 not good
{ninja.b3d} can show transparent alpha in OGLES-1 and use MyAlpha to adjust high low
why the {dwarf.x} can not show transparent effect in OGLES-1?
1.
is the file format not support alpha channel for .x in OGLES-1?
2.
what formats support?
///////////////
//mesh = smgr->getMesh( (GetBaseAppPath()+"game/ninja.b3d").c_str() );
mesh = smgr->getMesh( (GetBaseAppPath()+"game/dwarf.x").c_str() );
node = smgr->addAnimatedMeshSceneNode( mesh );
//////////////////////////////texture/////////////////////////////////////////////////
node->setMaterialTexture( 0, driver->getTexture((GetBaseAppPath()+"game/nskinrd.jpg").c_str()) );
node->setMaterialFlag(EMF_LIGHTING, true);
node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
u32 MyAlpha = 100;
u32 MaterialCount = node->getMaterialCount();
for(u32 i=0; i<MaterialCount; i++)
{
video::SMaterial& tex_mat = node->getMaterial(i);
tex_mat.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
tex_mat.MaterialTypeParam = 0.1;
tex_mat.MaterialTypeParam2 = 0.1;
tex_mat.AmbientColor.setAlpha(MyAlpha);
tex_mat.DiffuseColor.setAlpha(MyAlpha);
tex_mat.SpecularColor.setAlpha(MyAlpha);
tex_mat.EmissiveColor.setAlpha(MyAlpha);
}
//use it or not by platform
for(u32 i=0; i<mesh->getMeshBufferCount(); i++)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
for(u32 j=0; j<buffer->getVertexCount(); j++)
{
//vertex[j].Color = video::SColor(MyAlpha,255,255,255);
vertex[j].Color.setAlpha(MyAlpha);
}
}