Hi David,
On 3 March 2012 00:10, David Garcia <[email protected]> wrote:
> I coded a different version that mirrors the structure of the Win32 version.
> The code now is:
>
> std::istringstream istr( _traits->glContextVersion );
> unsigned int major, minor;
> unsigned char dot;
> istr >> major >> dot >> minor;
>
> if( OSG_GL3_FEATURES ){
> if( major < 3 ){
> OSG_NOTIFY( osg::WARN ) << "GL3: Non-GL3 version number: " <<
> _traits->glContextVersion << std::endl;
> }else{
> OSG_NOTIFY( osg::INFO ) << "GL3: Attempting to create OpenGL3
> context." << std::endl;
> OSG_NOTIFY( osg::INFO ) << "GL3: version: " <<
> _traits->glContextVersion << std::endl;
>
> #if defined(OSG_GL3_AVAILABLE)
> attr[i++] = NSOpenGLPFAOpenGLProfile;
> attr[i++] = NSOpenGLProfileVersion3_2Core;
> #endif
> }
> }
I've just reviewed this change and feel that it's going in the right
direction but could be improved by moving the major/minor version
number code into osg::Traits so that each the Cocoa .mm
implementations and the GraphicsWindowWin32.cpp would all share the
same code so avoiding chances of divergence in implementation/risk of
bugs.
To this end I have add an getContextVersion(unsigned int& major,
unsigned int& minor) const method to Traits that simply reads:
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;
}
I do wonder if the attribute setting might be combined for the in .mm
files as well. The openscenegraph server is down right now so I can't
check anything in right away, I'll do this once the server is back up.
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org