diff --git a/src/osmesa_context.c b/src/osmesa_context.c index 852d4e54..4f545073 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -200,6 +200,13 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, fbconfig->accumBlueBits + fbconfig->accumAlphaBits; + if (ctxconfig->client == GLFW_OPENGL_ES_API) + { + _glfwInputError(GLFW_API_UNAVAILABLE, + "OSMesa: OpenGL ES is not available on OSMesa"); + return GLFW_FALSE; + } + if (ctxconfig->share) share = ctxconfig->share->context.osmesa.handle; @@ -227,6 +234,13 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor); } + if (ctxconfig->forward) + { + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "OSMesa: Foward-compatible contexts not supported"); + return GLFW_FALSE; + } + setAttrib(0, 0); window->context.osmesa.handle = diff --git a/src/osmesa_window.c b/src/osmesa_window.c index 56923ec7..c010be53 100644 --- a/src/osmesa_window.c +++ b/src/osmesa_window.c @@ -47,18 +47,25 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - if (!_glfwInitOSMesa()) + if (!createNativeWindow(window, wndconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) { - if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) + if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API) + { + if (!_glfwInitOSMesa()) + return GLFW_FALSE; + if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + else + { + _glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: EGL not available"); return GLFW_FALSE; + } } - if (!createNativeWindow(window, wndconfig)) - return GLFW_FALSE; - return GLFW_TRUE; }