Added Traits::getContextVersion(uint,uint)
This commit is contained in:
@@ -123,7 +123,9 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
std::string glContextVersion;
|
||||
unsigned int glContextFlags;
|
||||
unsigned int glContextProfileMask;
|
||||
|
||||
|
||||
/** return true if glContextVersion is set in the form major.minor, and assign the appropriate major and minor values to the associated parameters.*/
|
||||
bool getContextVersion(unsigned int& major, unsigned int& minor) const;
|
||||
|
||||
// shared context
|
||||
GraphicsContext* sharedContext;
|
||||
|
||||
@@ -217,6 +217,18 @@ GraphicsContext::Traits::Traits(DisplaySettings* ds):
|
||||
}
|
||||
}
|
||||
|
||||
bool GraphicsContext::Traits::getContextVersion(unsigned int& major, unsigned int& minor) const
|
||||
{
|
||||
if (glContextVersion.empty()) return false;
|
||||
|
||||
std::istringstream istr( glContextVersion );
|
||||
unsigned char dot;
|
||||
istr >> major >> dot >> minor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
class ContextData
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1766,11 +1766,8 @@ HGLRC GraphicsWindowWin32::createContextImplementation()
|
||||
unsigned int idx( 0 );
|
||||
int attribs[ 16 ];
|
||||
|
||||
std::istringstream istr( _traits->glContextVersion );
|
||||
unsigned int major, minor;
|
||||
unsigned char dot;
|
||||
istr >> major >> dot >> minor;
|
||||
if( major < 3 )
|
||||
unsigned int major = 1, minor = 0;
|
||||
if( !_traitrs->getContextVersion(major, minor) || major<3 )
|
||||
{
|
||||
OSG_NOTIFY( osg::WARN ) << "GL3: Non-GL3 version number: " << _traits->glContextVersion << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user