+ GL_InitFunctions();
+
+#if !defined(USE_GLES2) && !defined(MACOSX)
+ // NVIDIA hates the Core profile and limits the version to the minimum we specified.
+ // HACK: to detect NVIDIA we first need a context, fortunately replacing it takes a few milliseconds
+ gl_vendor = (const char *)qglGetString(GL_VENDOR);
+ if (strncmp(gl_vendor, "NVIDIA", 6) == 0)
+ {
+ Con_DPrint("The Way It's Meant To Be Played: replacing OpenGL Core profile with Compatibility profile...\n");
+ SDL_GL_DeleteContext(context);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
+ context = SDL_GL_CreateContext(window);
+ if (context == NULL)
+ {
+ Con_Printf(CON_ERROR "Failed to initialize OpenGL context: %s\n", SDL_GetError());
+ VID_Shutdown();
+ return false;
+ }
+ }
+#endif
+