Enable OGL core profile for linux

objectmenu
Armin Burgmeier 2016-01-02 19:15:38 -08:00
parent e13cda4bd0
commit d7d24ca36a
3 changed files with 8 additions and 14 deletions

View File

@ -382,14 +382,10 @@ bool CStdGL::CreatePrimarySurfaces(unsigned int, unsigned int, int iColorDepth,
// store options
bool ok = RestoreDeviceObjects();
// - AMD GPUs have supported OpenGL 2.1 since 2007
// - nVidia GPUs have supported OpenGL 2.1 since 2005
// - Intel integrated GPUs have supported OpenGL 2.1 since Clarkdale (maybe earlier).
// And we've already been using features from OpenGL 2.1. Nobody has complained yet.
// So checking for 2.1 support should be fine.
if (!GLEW_VERSION_2_1)
// We need at least OpenGL 3.0
if (!GLEW_VERSION_3_0)
{
return Error(" gl: OpenGL Version 2.1 or higher required. A better graphics driver will probably help.");
return Error(" gl: OpenGL Version 3.0 or higher required. A better graphics driver will probably help.");
}
return ok;
}

View File

@ -480,6 +480,7 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
GLXContext dummy_ctx = glXCreateContext(dpy, vis_info, 0, True);
XFree(vis_info);
glXMakeCurrent(dpy, pWindow->renderwnd, dummy_ctx);
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (err != GLEW_OK)
{
@ -488,7 +489,10 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
// Create Context with sharing (if this is the main context, our ctx will be 0, so no sharing)
const int attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_FLAGS_ARB, (Config.Graphics.DebugOpenGL ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
None
};
GLXContext share_context = (pGL->pMainCtx != this) ? static_cast<GLXContext>(pGL->pMainCtx->ctx) : 0;
@ -511,6 +515,7 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
if (!ctx) return pGL->Error(" gl: Unable to create context");
if (!Select(true)) return pGL->Error(" gl: Unable to select context");
// init extensions
glewExperimental = GL_TRUE;
err = glewInit();
if (GLEW_OK != err)
{

View File

@ -612,13 +612,6 @@ bool C4LandscapeRenderGL::LoadShader(C4GroupSet *pGroups, C4Shader& shader, cons
bool C4LandscapeRenderGL::LoadShaders(C4GroupSet *pGroups)
{
// No support?
if(!GLEW_ARB_fragment_program)
{
Log(" gl: no shader support!");
return false;
}
// First, clear out all existing shaders
ClearShaders();