Results 1 to 2 of 2

Thread: Question for OGLES1 Alpha channel

  1. #1
    Lesser Wizard
    Join Date
    Feb 2013
    Posts
    142

    Default Question for OGLES1 Alpha channel

    follows are my code example

    My question is in OGLES[1]

    the {ninja.b3d} can show transparent alpha and use MyAlpha to adjust hi low

    why the {dwarf.x} can not show transparent effect?

    is the file format problem?


    ///////////////
    mesh = smgr->getMesh( (GetBaseAppPath()+"game/ninja.b3d").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);
    }

    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);
    }
    }



    https://plus.google.com/photos/10618...41018774360364
    Last edited by feelthat; 02-15-2015 at 11:43 AM.

  2. #2
    Lesser Wizard
    Join Date
    Feb 2013
    Posts
    142

    Default got answer

    http://irrlicht.sourceforge.net/foru...=37871#p220408

    there's no transparency flag in .x, which means that we don't create transparency settings.




    Quote Originally Posted by feelthat View Post
    follows are my code example

    My question is in OGLES[1]

    the {ninja.b3d} can show transparent alpha and use MyAlpha to adjust hi low

    why the {dwarf.x} can not show transparent effect?

    is the file format problem?


    ///////////////
    mesh = smgr->getMesh( (GetBaseAppPath()+"game/ninja.b3d").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);
    }

    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);
    }
    }

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •