From f457223bdf8d9b6f8c949e098ab9fd161ae2218b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 22 Jul 2012 17:06:37 +0200 Subject: [PATCH] Minor context creation fixes. --- src/x11_egl_opengl.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/x11_egl_opengl.c b/src/x11_egl_opengl.c index c790b311..ded3c612 100644 --- a/src/x11_egl_opengl.c +++ b/src/x11_egl_opengl.c @@ -176,8 +176,10 @@ static void refreshContextParams(_GLFWwindow* window) //======================================================================== #define setEGLattrib(attribs, index, attribName, attribValue) \ +{ \ attribs[index++] = attribName; \ - attribs[index++] = attribValue; + attribs[index++] = attribValue; \ +} static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, @@ -253,9 +255,23 @@ static int createContext(_GLFWwindow* window, } if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) - eglBindAPI(EGL_OPENGL_ES_API); + { + if (!eglBindAPI(EGL_OPENGL_ES_API)) + { + _glfwSetError(GLFW_PLATFORM_ERROR, + "X11/EGL: OpenGL ES is not supported"); + return GL_FALSE; + } + } else - eglBindAPI(EGL_OPENGL_API); + { + if (!eglBindAPI(EGL_OPENGL_API)) + { + _glfwSetError(GLFW_PLATFORM_ERROR, + "X11/EGL: OpenGL is not supported"); + return GL_FALSE; + } + } index = 0; @@ -320,7 +336,7 @@ static int createContext(_GLFWwindow* window, // TODO: Handle all the various error codes here _glfwSetError(GLFW_PLATFORM_ERROR, - "X11/EGL: Failed to create OpenGL ES context"); + "X11/EGL: Failed to create context"); return GL_FALSE; }