Hi Robert,

I understand the multitexturecontrol example, I modified it and slenderized it, 
so that I simply can shift the textureWeight between my two examples. 

But the output is not correct. I suppost my model is not correct textured.

therefore I need to know what a) the right structure is or b) what the reight 
procedure is to generate the right structur.
Unfortunately the is no doc so I failed to learn it myself.

My startingpoint:
I have a model, which has a texture. Aditionally I have a not used 2nd 
texturefile, which I'd like to ambed as second user, so I can switch between 
texture1 und texture 1 ( day texture and night texture).

I load my model, and put it after an osgFX::MultiTextureControl node.

if i switch textureweight, it changes the look, the background behind the 
texture changes, and if I focus totaly to the second texture, no texture is 
visible.

what wiiould be the correct way to texturize my model.
Because one texturunit is in use, I suppose the textureVertices shouldn't be 
any problem, because they exist already.

I simply want to change change the texture.

This was my code to add the 2nd texture:

Code:

bool airportCreator::addTexture( osg::Node* node_, std::string textureFile_, 
int textureUnit_)
{
                // check to see if we have a valid (non-NULL) node.
   // if we do have a null node, return NULL.
   if ( !node_)
   {
      return false;
   }

   osg::Geode* geode = getFirstGeode( node_ );
   if (!geode)
           return false;

    osg::Texture2D* texNode = new osg::Texture2D;

   // protect from being optimized away as static state:
        texNode->setDataVariance(osg::Object::DYNAMIC); 

   // load an image by reading a file: 
   osg::Image* texImage = osgDB::readImageFile(textureFile_);
   if (!texImage)
   {
           qDebug() << "Error couldn't find texture '" << textureFile_.c_str() 
<< "', quiting.";
      return false;
   }

   // Assign the image we read from file to the texture: 
   texNode->setImage(texImage);

   // Assign texture Node to node.
   //node_->getOrCreateStateSet()->setTextureAttributeAndModes( textureUnit_, 
texNode, osg::StateAttribute::ON );
   geode->getStateSet()->setTextureAttributeAndModes( textureUnit_, texNode, 
osg::StateAttribute::ON );

        return true;
}




Can you help me?
 

Thank you in advance,

Torben

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=21863#21863





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to