Hi J-S,

On Sun, 2005-12-11 at 18:41 -0500, Jean-Sebastien Guay wrote:
> Hello Dirk,
> 
> Thanks for the example code. I used your exact code, except that I modified 
> the
> last one to look like this :
> 
> void Arrow::makeTrans(NodePtr& node)
> {
>     GeometryPtr geo = GeometryPtr::dcast(node->getCore());
>     if(geo!=NullFC)
>     {
>         doMat(geo->getMaterial());
>     }
> 
>     MaterialGroupPtr mg = MaterialGroupPtr::dcast(node->getCore());
>     if(mg!=NullFC)
>     {
>         doMat(mg->getMaterial());
>     }
> 
>     for (unsigned int i = 0; i < node->getNChildren(); i++) {
>         NodePtr child = node->getChild(i);
>         makeTrans( child );
>     }
> }
> 
> So that instead of using a traversal functor, the function traverses all
> children by itself (it's more convenient in my case, but should give the same
> result, shouldn't it?)

Yup, that should be fine. Does it ever go into doMat?

> Well, it still doesn't give any transparency on the objects where it should. 
> The
> objects stay fully opaque all the time.

Weird. Could you send me one your models, so that I can see if it's
somehow related to the model?

> I just tried something else : I added a TextureTransformChunk to a
> SimpleTexturedMaterial (which is a subclass of ChunkMaterial, so that should
> work right?) and tried translating the texture with that. It doesn't do
> anything either. Could those two problems be related? The code I use for the
> TextureTransformChunk is simply:
> 
>     mWaterTextureTransform = TextureTransformChunk::create();
>     OSG::beginEditCP( mWaterTextureTransform );
>     {
>         Matrix transform( Matrix::identity() );
>         mWaterTextureTransform->setMatrix( transform );
>     }
>     OSG::endEditCP  ( mWaterTextureTransform );
> 
>     SimpleMaterialPtr waterMaterial = mWater->getMaterial();
>     OSG::beginEditCP( waterMaterial );
>     {
>         waterMaterial->addChunk( mWaterTextureTransform );
>     }
>     OSG::endEditCP  ( waterMaterial );
> 
> And then, when I want to translate it (at every frame):
> 
>     Vec3f translation( 0.0f, 0.0f, mBoatVelocity * delta_sec );
> 
>     mWaterTranslation += translation;
>     OSG::beginEditCP( mWaterTextureTransform );
>     {
>         mWaterTextureTransform->getMatrix().setTranslate( mWaterTranslation );

I would use setTransform(), but either way should work just fine.

>     }
>     OSG::endEditCP  ( mWaterTextureTransform );
> 
> Basically, at this point, for this project, I've kind of given up on getting
> these two things working. But I'd still like to know what I'm doing wrong,
> because I'd like to use OpenSG for some projects in the future.

I'm stumped. Without seeing your program it's going to be heard to
analyze, because it all looks correct to me. :(

        Dirk







-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to