Vamsi Krishna
unread,Oct 1, 2009, 12:27:13 AM10/1/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to G3D Users
Hi all,
I've been trying to set a mesh transparent (rather translucent). Here
is the scenario:
I've two different meshes, one lying inside the other. I want to set
the outer mesh transparent, and inner one opaque.
I've tried various versions by modifying the below mentioned code. Can
you please help me out with this? I'm having this code inside a render
() function which loops continuously.
// inner mesh
rd->pushState();
//rd->setBlendFunc(G3D::RenderDevice::BLEND_ONE,
G3D::RenderDevice::BLEND_ZERO, G3D::RenderDevice::BLENDEQ_ADD);
rd->setObjectToWorldMatrix(_virtualToRoomSpace * CoordinateFrame
(Vector3(0,0,-5)) * cfRight[loopVar]);
inner_mesh->draw(rd);
rd->popState();
//outer mesh
rd->pushState();
//setting the alpha value for transparent effect
rd->setBlendFunc(G3D::RenderDevice::BLEND_SRC_ALPHA,
G3D::RenderDevice::BLEND_ONE_MINUS_SRC_ALPHA,
G3D::RenderDevice::BLENDEQ_ADD);
rd->setObjectToWorldMatrix(_virtualToRoomSpace * CoordinateFrame
(Vector3(0,0,-5)) );
outermesh->draw(rd);
//resetting back
rd->setBlendFunc(G3D::RenderDevice::BLEND_ONE,
G3D::RenderDevice::BLEND_ZERO, G3D::RenderDevice::BLENDEQ_ADD);
rd->popState();
Thanks,
Vamsi