MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / initialiseContext

Method initialiseContext

RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp:3291–3343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3289 }
3290
3291 void GL3PlusRenderSystem::initialiseContext( Window *primary )
3292 {
3293 // Set main and current context
3294 mMainContext = 0;
3295 primary->getCustomAttribute( "GLCONTEXT", &mMainContext );
3296 mCurrentContext = mMainContext;
3297
3298 // Set primary context as active
3299 if( mCurrentContext )
3300 mCurrentContext->setCurrent();
3301
3302 // Initialise GL3W
3303 int gl3wRetStatus = gl3wInit();
3304 if( gl3wRetStatus != GL3W_OK )
3305 {
3306 if( gl3wRetStatus != GL3W_ERROR_INIT )
3307 {
3308#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
3309 const String dllName = "opengl32.dll";
3310#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
3311 const String dllName = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
3312#else
3313 const String dllName = "libGL.so.1";
3314#endif
3315 LogManager::getSingleton().logMessage(
3316 "ERROR: " + dllName + " failed to load. OpenGL not installed correctly?",
3317 LML_CRITICAL );
3318 }
3319
3320 LogManager::getSingleton().logMessage( "Failed to initialize GL3W", LML_CRITICAL );
3321 }
3322 else
3323 {
3324 // Setup GL3PlusSupport
3325 mGLSupport->initialiseExtensions();
3326 }
3327
3328 // Make sure that OpenGL 3.3+ is supported in this context
3329 if( gl3wRetStatus != GL3W_OK || !mGLSupport->hasMinGLVersion( 3, 3 ) )
3330 {
3331 OGRE_EXCEPT( Exception::ERR_RENDERINGAPI_ERROR,
3332 "OpenGL 3.3 is not supported. Please update your graphics card drivers.",
3333 "GL3PlusRenderSystem::initialiseContext" );
3334 }
3335
3336 mHasGL43 = mGLSupport->hasMinGLVersion( 4, 3 );
3337 mSupportsTargetIndependentRasterization =
3338 mHasGL43 || mGLSupport->checkExtension( "GL_ARB_framebuffer_no_attachments" );
3339
3340 LogManager::getSingleton().logMessage( "**************************************" );
3341 LogManager::getSingleton().logMessage( "*** OpenGL 3+ Renderer Started ***" );
3342 LogManager::getSingleton().logMessage( "**************************************" );
3343 }
3344
3345 GLenum GL3PlusRenderSystem::convertCompareFunction( CompareFunction func ) const
3346 {

Callers

nothing calls this directly

Calls 7

gl3wInitFunction · 0.85
getCustomAttributeMethod · 0.45
setCurrentMethod · 0.45
logMessageMethod · 0.45
initialiseExtensionsMethod · 0.45
hasMinGLVersionMethod · 0.45
checkExtensionMethod · 0.45

Tested by

no test coverage detected