osghello

i'm desperately trying to find a texturechunk related bug in my scene. 
before i type a lot of words, check out the problem with the chimneys 
in the video (flickering dependend on camera position):
http://www.vision.ee.ethz.ch/~shaegler/temp/opensg-texture-bug.mpg

here is my material definition:

---

osg::ImagePtr imagePtr = osg::Image::create();
osg::beginEditCP(imagePtr);
        imagePtr->read(texturefile.c_str());
osg::endEditCP(imagePtr);

// create tex1 chunk
osg::TextureChunkPtr texChunk = osg::TextureChunk::create();
osg::beginEditCP(texChunk);
        texChunk->setImage (imagePtr);
        texChunk->setEnvMode (GL_MODULATE);
        texChunk->setMagFilter (GL_LINEAR);
        texChunk->setMinFilter (GL_NEAREST_MIPMAP_LINEAR);
        texChunk->setWrapS (GL_REPEAT);
        texChunk->setWrapT (GL_REPEAT);
osg::endEditCP(texChunk);

osg::TextureTransformChunkPtr tex1TrafoChunk) 
  = osg::TextureTransformChunk::create();
osg::beginEditCP(tex1TrafoChunk));
        osg::Matrix m;
        m.setScale(s, t, 1.0);
        tex1TrafoChunk)->setMatrix(m);
osg::endEditCP(tex1TrafoChunk));

// tex2 chunk similar...
...

// material chunk
matChunk = MaterialChunk::create();
beginEditCP(matChunk);
   matChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE);
   matChunk->setDiffuse(Color4f(mIt->color[0], mIt->color[1], 
     mIt->color[2], mIt->color[3] ));
   matChunk->setShininess(5.0f);
endEditCP(matChunk);

// create chunk material
osg::ChunkMaterialPtr chunkMat = osg::ChunkMaterial::create();
osg::beginEditCP(chunkMat);        
        chunkMat->addChunk(matChunk);        
        if (tex1Chunk)
          chunkMat->addChunk(tex1Chunk);        
        if (tex1Chunk && tex1TrafoChunk)
          chunkMat->addChunk(tex1TrafoChunk);
        if (tex1Chunk && tex2Chunk)
          chunkMat->addChunk(tex2Chunk);
        chunkMat->setSortKey(0);
osg::endEditCP(chunkMat);
chunkMat->rebuildState();

---

the different chunks get shared over a lot of nodes. but the problem 
persists even if i deepClone every chunk.

observations:
* the problem seems to be texture coordinate or texture unit related
* the problem is also present if i only use texture chunk 1 in the 
code above...
* the problem is somehow related to culling and camera distance

my system:
linux 64bit, nvidia quadro FX 4500, driver 169.12

any help is greatly appreciated & cheers,
simon

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to