From f0bf34fceed93398a69fd11b8c61bc80e3d7d6ab Mon Sep 17 00:00:00 2001 From: Zachary Lund Date: Wed, 5 Aug 2015 18:14:12 -0500 Subject: [PATCH] Explicitly request a context version. Mesa doesn't support ARB_compatibility. It also doesn't default to the latest context. We can either make a context and test GL_VERSION... or just try to make contexts until we get one we can use. --- tests/hlsl2glsltest/hlsl2glsltest.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/hlsl2glsltest/hlsl2glsltest.cpp b/tests/hlsl2glsltest/hlsl2glsltest.cpp index a9df844..006f84e 100644 --- a/tests/hlsl2glsltest/hlsl2glsltest.cpp +++ b/tests/hlsl2glsltest/hlsl2glsltest.cpp @@ -75,7 +75,7 @@ static void logf(const char* format, ...) #include #include #include -#include +#include #endif #include "../../include/hlsl2glsl.h" @@ -259,9 +259,25 @@ static bool InitializeOpenGL () #else int argc = 0; char** argv = NULL; + glutInit(&argc, argv); - glutCreateWindow("hlsl2glsltest"); + int tmp_window = glutCreateWindow("hlsl2glsltest"); + glewInit(); + + if (GLEW_VERSION_3_2) { /* GLSL 1.5 */ + glutInitContextVersion(3, 2); + } else if (GLEW_VERSION_3_1) { /* GLSL 1.4 */ + glutInitContextVersion(3, 1); + } else if (GLEW_VERSION_2_1) { /* GLSL 1.2 */ + glutInitContextVersion(2, 1); + } + + glutInitContextProfile(GLUT_CORE_PROFILE); + + glutDestroyWindow(tmp_window); + glutCreateWindow("hlsl2glsltest"); + #endif // check if we have GLSL