Just as a follow-up, I stumbled across a post which indicated part of the
problem may lie in the compiler. I should point out that I'm using OSG with
VS2010.
I'm also starting to wonder if this has something more to do with OpenGL than
with OSG. I tried accessing the shader info log immediately after loading the
shader and binding it to the program object, with the same result.
Code:
//load shaders
osg::ref_ptr<osg::Shader> vertexShader1(
osg::Shader::readShaderFile (osg::Shader::VERTEX,
"C:/OpenSceneGraph/OpenSceneGraph-Data-2.8.0/myShaders/pass1.vert"));
osg::ref_ptr<osg::Shader> geometryShader1(
osg::Shader::readShaderFile (osg::Shader::GEOMETRY,
"C:/OpenSceneGraph/OpenSceneGraph-Data-2.8.0/myShaders/test.geom"));
osg::ref_ptr<osg::Shader> fragShader1(
osg::Shader::readShaderFile (osg::Shader::FRAGMENT,
"C:/OpenSceneGraph/OpenSceneGraph-Data-2.8.0/myShaders/pass1.frag"));
//set up program
osg::ref_ptr<osg::Program> pass1 (new osg::Program());
pass1->addShader(vertexShader1);
pass1->addShader(geometryShader1);
pass1->addShader(fragShader1);
pass1->addBindAttribLocation("osg_Vertex", 0);
pass1->addBindAttribLocation("osg_Normal", 2);
//create stateset
geodePass1->getOrCreateStateSet()->setAttribute(pass1);
//test info log
std::string log="";
geometryShader1->getGlShaderInfoLog(0, log);
Regardless of what's in the info log, it seems to me that it ought to return
something, if only an empty string, but I get the error instead...
Just for reference, the error is: "Unhandled exception at 0xcdcdcdcd in
OSG-shader.exe: 0xC0000005: Access violation."
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34866#34866
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org