Re: [osg-users] Shader, OpenGL context and Qt

2016-09-20 Thread Valerian Merkling
Hi,

After a few more days of search, I can resume my problem in a more simple way :

I've a set of osg::Program.

Each Widgets has its own contextID, and contextID can be re-used.

The first time I load the osg::Program "my_program1" on a view with a contextID 
of 1, it's ok.

If then I load "my_program1" on a view with another contextID, it's still ok.
If I load another osg::Program on a view with a contextID of 1, it's still ok.

But if I close / reopen view enough to get another view with a contextID = 1, 
then loading "my_program1" won't work (the shaders are not used).


Does anyone knows what is happening ?

Thanks for you help !

Valerian.

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shader, OpenGL context and Qt

2016-09-16 Thread Valerian Merkling
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 vertex=new osg::Shader(osg::Shader::Type::VERTEX, 
vertex_source);
osg::ref_ptr fragment=new osg::Shader(osg::Shader::Type::VERTEX, 
vertex_source);
osg::ref_ptr 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 vertex=new osg::Shader(osg::Shader::Type::VERTEX, 
vertex_source);
osg::ref_ptr fragment=new osg::Shader(osg::Shader::Type::VERTEX, 
vertex_source);
osg::ref_ptr 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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org