Made glfwOpenWindow enforce the forward-compat and profile hints.

This commit is contained in:
Camilla Berglund 2012-03-05 20:27:47 +01:00
parent 4b21ccbe19
commit cb9bae5c71
2 changed files with 13 additions and 3 deletions

View File

@ -313,6 +313,7 @@ version of GLFW.</p>
<li>[Cocoa] Postponed menu creation to first window creation</li> <li>[Cocoa] Postponed menu creation to first window creation</li>
<li>[Cocoa] Replaced <code>NSDate</code> time source with <code>mach_absolute_time</code></li> <li>[Cocoa] Replaced <code>NSDate</code> time source with <code>mach_absolute_time</code></li>
<li>[Cocoa] Replaced deprecated CoreGraphics calls in video mode enumeration</li> <li>[Cocoa] Replaced deprecated CoreGraphics calls in video mode enumeration</li>
<li>[Cocoa] Bugfix: <code>glfwOpenWindow</code> did not properly enforce the forward-compatible and context profile hints</li>
<li>[Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable</li> <li>[Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable</li>
<li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li> <li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li>
<li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li> <li>[Cocoa] Bugfix: <code>glfwInit</code> changed the current directory for unbundled executables</li>

View File

@ -675,14 +675,23 @@ static GLboolean createContext(_GLFWwindow* window,
return GL_FALSE; 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) if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
{ {
_glfwSetError(GLFW_VERSION_UNAVAILABLE, _glfwSetError(GLFW_VERSION_UNAVAILABLE,
"Cocoa/NSOpenGL: The targeted version of Mac OS X " "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; return GL_FALSE;
} }
} }