Hi Ryan,

I guess your interfering with the currently set context. You're not explaining where/when you call your snippet, but usually this would be done inside a "realizeOperation".

A small example operation:

<code>
class TestSupportOperation: public osg::GraphicsOperation
{
public:

        TestSupportOperation()
        : osg::GraphicsOperation("TestSupportOperation",false){}

        virtual void operator () (osg::GraphicsContext* gc)
        {
                OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mMutex);
                unsigned int contextID =        gc->getState()->getContextID(); 
          

                osg::GLExtensions* glext = osg::GLExtensions::Get(contextID, 
true);
                if (!glext->isOpenGL20Supported)
                {
                        std::cerr << No 2.0++ suppport available\n";
                }
        }
        OpenThreads::Mutex      mMutex;
};
</code>

In your viewer you simply add:

viewer->setRealizeOperation(new TestSupportOperation);


Hope that helps,
Sebastian




Hi,

I'm trying to query GL parameters such as GL_VENDOR, which require an active 
graphics context to work.  I looked another thread on this forum which explains 
how to do it, but it only works for a single-threaded viewer.  I'm running the 
viewer in multithreaded mode, and am getting crashes due to context issues.  
Does anyone have an idea on how to do this?
Thanks

Example code.  Usually crashes at the makeCurrent() line:

Code:

//get renderer information
osgViewer::ViewerBase::Contexts contexts;
viewer->getContexts(contexts, true);
contexts[0]->makeCurrent();
std::string vendor = (const char*)glGetString(GL_VENDOR);
Report("Vendor: " + vendor);
contexts[0]->releaseContext();




Ryan

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





_______________________________________________
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

Reply via email to