Hi Paul,
Thanks for your reply.
I have decided to try using draw callbacks, and the osg encapsulation of shader
programs. However, I have another question.
How can we access the OpenGL pointer to an osg::program containing shaders? We
need this pointer to set up transform feedback.
I currently try to get the pointer to the per context program as I show below.
Code:
class CameraUpdateCallback : public osg::NodeCallback
{
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
std::cout<<"Camera update callback - pre traverse"<<node<<std::endl;
//apply the test shaders to the node
node->getOrCreateStateSet()->setAttribute(outputShaders);
//on the first iteration, there is no graphics context, so
check that there is
if(viewer->getCamera()->getGraphicsContext()->getState()->getContextID)
{
GLuint cid =
viewer->getCamera()->getGraphicsContext()->getState()->getContextID();
osg::Program::PerContextProgram* pcp =
feedbackShaders->getPCP(cid);
GLuint shaderID = pcp->getHandle();
//these two lines give errors
//posLoc = glGetVaryingLocationNV(shaderID, "gl_Position");
//glTransformFeedbackVaryingsNV(shaderID, 1, &posLoc,
GL_INTERLEAVED_ATTRIBS_NV);
}
traverse(node,nv);
std::cout<<"Camera update callback - post traverse"<<node<<std::endl;
}
};
I would appreciate any help you can provide.
Thanks,
Ethan
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=29554#29554
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org