Bob Youmans wrote on Wednesday, July 08, 2009 3:51 PM: > Hi all, I'm trying to figure out the best method to pass per vertex > "attributes" to shaders using osg and I can't seem to find many examples of > attribute use. My guess is there's a reason for that and I should probably > code up a uniform array of some kind instead. I need to pass "thickness" as > an "attribute" and that varies with the geometry / osg::Geode. I've studied > the osg::Drawable and its attribute types, and the osg::Program and its > addBindAttribLocation, but I can't find any examples of the callback or other > mechanism to actually get the data set into the attributes from the > scenegraph. I must be missing something, and I'm really new at this shader > stuff. Can anybody point me in the right direction? Should I not try to use > shader attributes, but instead use a uniform array and look up my data in > there? If I do use shader attributes, where's an example?
Using a normal array is unlikely to allow a big enough array for all your vertices :) See osg::Geometry::setVertexAttribArray(), setVertexAttribBinding(), etc. It doesn't look like there are any examples for using vertex attributes, though. -- Bryan Thrall FlightSafety International [email protected] _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

