[osg-users] Shader, OpenGL context and Qt

Valerian Merkling niarkoleptik at gmail.com
Fri Sep 16 08:30:36 PDT 2016


Hi,

I'm still stuck with my shaders problem and I ran out of ideas, but I have new elements, and a new question.

My shader works on the first view, so this code is ok (ie thoses two shaders works fine) :


Code:

osg::ref_ptr<osg::Shader> vertex=new osg::Shader(osg::Shader::Type::VERTEX, vertex_source);
osg::ref_ptr<osg::Shader> fragment=new osg::Shader(osg::Shader::Type::VERTEX, vertex_source);
osg::ref_ptr<osg::Program> program=new osg::Program();
program->addShader(vertex);
program->addShader(fragment);





Then I tried to emulate the "close the view open a new an try again" with this :


Code:

osg::ref_ptr<osg::Shader> vertex=new osg::Shader(osg::Shader::Type::VERTEX, vertex_source);
osg::ref_ptr<osg::Shader> fragment=new osg::Shader(osg::Shader::Type::VERTEX, vertex_source);
osg::ref_ptr<osg::Program> program=new osg::Program();
program->addShader(vertex);
program->addShader(fragment);

program = nullptr;
program->addShader(vertex);
program->addShader(fragment);




And shaders are now broken (fixed pipeline is used instead, so I can see stuff but no shiny effects :( )

Is it a known and wanted behavior ? Do I really have to load my shaders once and for all ?

Thanks for you help !

Valerian.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68629#68629








More information about the osg-users mailing list