Hi Dirk,

Sorry to do a followup on such an old mail, but I've managed to run into
new problems - as usual. :-)))


On Wed, 29 Oct 2003, Dirk Reiners wrote:

> So here's what you can do: call renderact->setZWriteTrans(true); on your
> RenderAction to make the transparent polygons change the Z-Buffer or
> change the BlendChunk to use an alpha key (setAlphaFunc(GL_NOTEQUAL);
> setAlphaValue(0);).

I did that and it works great on the cluent, but doesn't work on the
servers for some reason... :-\

I add a blendchunk to all materials to handle the alpha-keys, and a
polygonchunk to be able to switch to wireframe if necessary.

Here's the relevant code:

----------------------------------------------------------------------
// Traverse the loaded scene and add alpha-keys to all materials
// Plus add the support for wireframe (polygonchunk)
Action::ResultE addChunks(NodePtr& node)
{
    if(node->getCore()->getType().isDerivedFrom( ChunkMaterial::getClassType()))
    {
        ChunkMaterialPtr m = ChunkMaterialPtr::dcast(node->getCore());
        if ( checkIfChunksPresent( m ) == false )
        {
            beginEditCP( m, ChunkMaterial::ChunksFieldId );
            m->addChunk( gcl_blendchunk );
            m->addChunk( gcl_polychunk );
            endEditCP  ( m, ChunkMaterial::ChunksFieldId );
        }
        SLOG << "derived from material, adding chunks" << endLog;
        //return Action::Skip;
    }

    if(node->getCore()->getType().isDerivedFrom( MaterialGroup::getClassType()))
    {
        MaterialPtr m = MaterialGroupPtr::dcast(node->getCore())->getMaterial();
        ChunkMaterialPtr cm = ChunkMaterialPtr::dcast( m );
        if ( checkIfChunksPresent( cm ) == false )
        {
            beginEditCP( cm /*, ChunkMaterial::ChunksFieldId */);
            cm->addChunk( gcl_blendchunk );
            cm->addChunk( gcl_polychunk );
            endEditCP  ( cm /*, ChunkMaterial::ChunksFieldId */);
            SLOG << "derived from groupmaterial, adding chunks" << endLog;
        }
        //return Action::Skip;
    }
    return Action::Continue;

}

---------------------------------------------------------------------------

The funny thing is that the polygonchunk works on the servers aswell (i.e.
I can switch to and from wireframe) so the material changes _are_
propagated but the blending doesn't work at all. ;(

BTW Gerrit's VRML loader creates MaterialGroups, that's why I was playing
with the beginEditCP/endEditpCP calls above but there was no difference
whatsoever.

Any ideas? :)

Thanks,
        Akos



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to