From cb9bae5c71382a517e8a22a2773cb6521b6b1d6c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 5 Mar 2012 20:27:47 +0100 Subject: [PATCH] Made glfwOpenWindow enforce the forward-compat and profile hints. --- readme.html | 1 + src/cocoa_window.m | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/readme.html b/readme.html index 5943be58..5762b023 100644 --- a/readme.html +++ b/readme.html @@ -313,6 +313,7 @@ version of GLFW.

  • [Cocoa] Postponed menu creation to first window creation
  • [Cocoa] Replaced NSDate time source with mach_absolute_time
  • [Cocoa] Replaced deprecated CoreGraphics calls in video mode enumeration
  • +
  • [Cocoa] Bugfix: glfwOpenWindow did not properly enforce the forward-compatible and context profile hints
  • [Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable
  • [Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash
  • [Cocoa] Bugfix: glfwInit changed the current directory for unbundled executables
  • diff --git a/src/cocoa_window.m b/src/cocoa_window.m index defe8fce..46532778 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -675,14 +675,23 @@ static GLboolean createContext(_GLFWwindow* window, return GL_FALSE; } - if (wndconfig->glProfile) + if (wndconfig->glMajor > 2) { - // Fail if a profile other than core was explicitly selected + if (!wndconfig->glForward) + { + _glfwSetError(GLFW_VERSION_UNAVAILABLE, + "Cocoa/NSOpenGL: The targeted version of Mac OS X " + "only supports OpenGL 3.2 contexts if they are " + "forward-compatible"); + return GL_FALSE; + } + if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE) { _glfwSetError(GLFW_VERSION_UNAVAILABLE, "Cocoa/NSOpenGL: The targeted version of Mac OS X " - "only supports the OpenGL core profile"); + "only supports OpenGL 3.2 contexts if they use the " + "core profile"); return GL_FALSE; } }