// constructs an RCntxt object from a raw RNTCXT* pointer; this is where the // we set up the appropriate interface pointer based on the R version RCntxt::RCntxt(void *rawCntxt) { if (rawCntxt == NULL) return; else if (contextVersion() == RVersion34) pCntxt_ = boost::make_shared<RIntCntxt<RCNTXT_34> >( static_cast<RCNTXT_34*>(rawCntxt)); else if (contextVersion() == RVersion33) pCntxt_ = boost::make_shared<RIntCntxt<RCNTXT_33> >( static_cast<RCNTXT_33*>(rawCntxt)); else pCntxt_ = boost::make_shared<RIntCntxt<RCNTXT_32> >( static_cast<RCNTXT_32*>(rawCntxt)); }
Bool OpenGLGraphicDeviceLinux::Open( const RenderWindow & p_RenderOutput, const Version & p_Version ) { // Make sure that the GD is not already open. if( m_Open == true ) { std::cout << "[OpenGLGraphicDeviceLinux::BindOpenGLExtensions] The graphic device is already loaded.\n"; return false; } // Make sure that the render output is loaded if( p_RenderOutput.IsOpen( ) == false ) { std::cout << "[OpenGLGraphicDeviceLinux::BindOpenGLExtensions] The render output is not loaded.\n"; return false; } // Store the version of the opengl context that we want to create. // This function will create the best as possible if the version is set to 0.0 Version contextVersion( p_Version ); // Try to load the best context as possible if the version is set to the default version if( contextVersion == Version::Default ) { if( OpenBestVersion( p_RenderOutput, contextVersion ) != true ) { return false; } } // Try to load the requested context, if it fails, create the best context as possible. else { if( OpenVersion( p_RenderOutput, contextVersion ) == false ) { if( OpenBestVersion( p_RenderOutput, contextVersion ) != true ) { return false; } } } // Bind the OpenGL extensions if( OpenGL::BindOpenGLExtensions( contextVersion.GetMajor( ), contextVersion.GetMinor( ) ) != true ) { //bitTrace( "[GraphicDeviceWin32::Open] Can not bind the OpenGL extensions.\n" ); std::cout << "[OpenGL::BindOpenGLExtensions] Binding opengl extensions failed.\n"; return false; } // Set the default viewport to the window's size SetViewport( Vector2u32( 0, 0 ), p_RenderOutput.GetVideoMode( ).GetSize( ) ); // Set the some member varaibles m_Open = true; m_Version = contextVersion; m_pRenderOutput = const_cast<RenderWindow*>( &p_RenderOutput ); // Set default settings. DisableDepthTest( ); EnableTexture( ); DisableFaceCulling( ); DisableSmoothLines( ); // Return true at success. return true; }