Hi Andrey, The only way to find out whether a shader will compile without problems is to run a compile from a thread with a graphics context current. You can't do it from general threads. This makes it awkward to weave loading code with doing compile tests.
It is possible to do, much moving loading code into a graphics thread, or simply running your application single threaded, single context and just making the context current before you do any work. Robert. On 16 March 2015 at 07:50, Andrey Perper <[email protected]> wrote: > Hello.. > > 1) > I just plan to perform something like that: > > > Code: > osg::ref_ptr<osg::Shader> EarthLoQVert = > osgDB::readShaderFile(g_SceneGlobals.systemPath + > "media/programs/EarthLoQ.vert"); > > if(EarthLoQVert.isCompiledOK) > { > create1.......... > } > else > { > osg::ref_ptr<osg::Shader> EarthLoQVertexLighting = > osgDB::readShaderFile(g_SceneGlobals.systemPath + "media/programs > /EarthLoQVL.vert"); > > if(EarthLoQVertexLighting.isCompiledOK) > { > create2 > } > else > { > fatalError > } > } > > > > i need to know if my shader is compiled ok after loading! > then i can create scene states, otherwise i load other shader and create > other scene states > > thanks > > > 2) Are shaders with same names loaded single time ? > > > Code: > osg::ref_ptr<osg::Shader> EarthLoQVert = > osgDB::readShaderFile(g_SceneGlobals.systemPath + > "media/programs/EarthLoQ.vert"); > > osg::ref_ptr<osg::Shader> EarthLoQVert1 = > osgDB::readShaderFile(g_SceneGlobals.systemPath + > "media/programs/EarthLoQ.vert"); > > osg::ref_ptr<osg::Shader> EarthLoQVert2 = > osgDB::readShaderFile(g_SceneGlobals.systemPath + > "media/programs/EarthLoQ.vert"); > > > > or should i check it self ? > > 3) Same question like "2" is for: > > osg::ref_ptr<osg::Image> nrmlImage = > osgDB::readImageFile(g_SceneGlobals.systemPath + > "media/textures/earth/normalmap.bmp"); > > If there will be new questions - i will post that here... > thanks! > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=62958#62958 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

