Hello Mike,

BTW a working example of GLSL generic attributes is the diffraction
shader in
http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/osgtoy-data/compactdisc.osg
It binds a "tangent" attribute to slot   5.

I'll check that out. Can I just display the osg file with osgviewer,  or
do I need osgToy?

The file loads into stock OSG, no osgToy library needed.

Ok, I tried it and it indeed works. It's very useful to be able to inspect an example like this. Thanks.

Try passing your data in an unused texcoord rather than a generic attribute.
Do you have ATI graphics by any chance?  Their driver has had trouble w/
genering attributes.  There's another version of that scene called
compactdisc-texcoord.osg, the only difference being how the attributes are sent.

Nope, thanks for your help but that wasn't the problem. I found it yesterday. I had two problems actually:

1) my NodeVisitor's apply(osg::Geode&) method wasn't getting called, and that's where I was setting the vertex attributes, so obviously they weren't set.

2) trying to get the number of vertices (or normals) of an osg::Geometry, I was using geometry->getVertexArray()->getDataSize() but this doesn't return the right value, I needed to use geometry->getVertexArray()->getNumElements() instead.

So now, that part works as expected, which is great. My vertex attributes are properly usable in the vertex shader. I had never used osg::Geometry objects directly like this so there were some things that were unclear about their usage, but now I seem to have gotten the hang of it.

Thanks again,

J-S
--
______________________________________________________
Jean-Sebastien Guay     [EMAIL PROTECTED]
                        http://whitestar02.webhop.org/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to