Show
Ignore:
Timestamp:
07/06/10 14:19:26 (4 years ago)
Author:
robert
Message:

Added compile/release and resize of GL objects to ShaderAttribute?.

Removed the StateAttribute::compose() method.

Fixed the default type value in ShaderAttribute?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgshadercomposition/osgshadercomposition.cpp

    r11667 r11668  
    3232    osg::Vec3d position(0.0,0.0,0.0); 
    3333 
     34    osg::ShaderAttribute* sa1 = NULL; 
     35 
    3436    { 
    3537        osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform; 
     
    4143        osg::StateSet* stateset = pat->getOrCreateStateSet(); 
    4244        osg::ShaderAttribute* sa = new osg::ShaderAttribute; 
     45        //sa->setType(osg::StateAttribute::Type(10000)); 
     46        sa1 = sa; 
    4347        stateset->setAttribute(sa); 
    4448 
     
    7377 
    7478    } 
     79#if 1 
     80    { 
     81        osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform; 
     82        pat->setPosition(position); 
     83        pat->addChild(node); 
    7584 
     85        position.x() += spacing; 
     86 
     87        osg::StateSet* stateset = pat->getOrCreateStateSet(); 
     88        osg::ShaderAttribute* sa = new osg::ShaderAttribute; 
     89        //sa->setType(osg::StateAttribute::Type(10000)); 
     90        stateset->setAttribute(sa); 
     91 
     92        // reuse the same ShaderComponent as the first branch 
     93        sa->setShaderComponent(sa1->getShaderComponent()); 
     94        sa->addUniform(new osg::Uniform("myColour",osg::Vec4(1.0f,1.0f,0.0f,1.0f))); 
     95 
     96        group->addChild(pat); 
     97 
     98    } 
     99#endif 
    76100    return group; 
    77101}