[osg-users] how to add shader to osgcal node

14 views
Skip to first unread message

yang zhiyuan

unread,
Nov 12, 2008, 8:49:41 AM11/12/08
to osg-...@lists.openscenegraph.org
Hi:
    I am trying to add shader to osgcal node.
    I do it like this:
  
   osgCal::CoreModel *core = new osgCal::CoreModel("dummy");
 load(core); //< loading some data into it
 // Creating a concrete model using the core template
 osgCal::Model *model = new osgCal::Model();
 model->create(core);
 osgCal::Model *model_2 = new osgCal::Model();
 model_2->create(core);
 //osgCal::Model *model = new osgCal::Model(core);
 // Setting the first animation in loop mode, weight 1, and starting just now
 model->startLoop(0, 1.0f, 0.0f);
 model_2->startLoop(1, 1.0f, 0.0f);
 model_2->setTimeScale(1.5f);
 osg::ref_ptr<osg::Group> escena = new osg::Group();
 escena->addChild(model);
 escena->addChild(model_2);
osg::StateSet* stateSet = escena->getOrCreateStateSet();
osg::Program* program= new osg::Program;
osg::Shader*   shader = new osg::Shader(osg::Shader::VETEXT);
.......
 
the problem is the shander does not apply to the osg node,is there any other way to add shader to osgcal node?

Brian R Hill

unread,
Nov 12, 2008, 10:00:39 AM11/12/08
to OpenSceneGraph Users
A problem you'll have is that the osgcal model has it's own shaders applied
down at the geometry level. These will override the one's you are applying
further up the graph.

Brian

-----osg-user...@lists.openscenegraph.org wrote: -----

To: osg-...@lists.openscenegraph.org
From: "yang zhiyuan" <yang...@gmail.com>
Sent by: osg-user...@lists.openscenegraph.org
Date: 11/12/2008 08:49AM
Subject: [osg-users] how to add shader to osgcal node

Hi:

model_2->setTimeScale(1.5f);

.......

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


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

Reply all
Reply to author
Forward
0 new messages