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