Comment updates.

This commit is contained in:
Camilla Berglund 2011-03-04 17:49:36 +01:00
parent 2f7bfb89e4
commit 5d2edb2dff

View File

@ -457,8 +457,8 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
} }
// Figure out if the current one is better than the best one found so far // Figure out if the current one is better than the best one found so far
// Missing buffers is the most important heuristic, then color buffer size // Least number of missing buffers is the most important heuristic,
// mismatches and lastly size mismatches for other buffers // then color buffer size match and lastly size match for other buffers
if (missing < leastMissing) if (missing < leastMissing)
closest = current; closest = current;
@ -556,7 +556,6 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN) if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN)
{ {
// Invalid window mode
glfwCloseWindow(window); glfwCloseWindow(window);
_glfwSetError(GLFW_INVALID_ENUM, "glfwOpenWindow: Invalid enum for 'mode' parameter"); _glfwSetError(GLFW_INVALID_ENUM, "glfwOpenWindow: Invalid enum for 'mode' parameter");
return GL_FALSE; return GL_FALSE;
@ -587,14 +586,14 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
window->height = height; window->height = height;
window->mode = mode; window->mode = mode;
// Platform specific window opening routine // Open the actual window and create its context
if (!_glfwPlatformOpenWindow(window, &wndconfig, &fbconfig)) if (!_glfwPlatformOpenWindow(window, &wndconfig, &fbconfig))
{ {
glfwCloseWindow(window); glfwCloseWindow(window);
return GL_FALSE; return GL_FALSE;
} }
// Get window parameters (such as color buffer bits etc) // Cache the actual (as opposed to desired) window parameters
glfwMakeWindowCurrent(window); glfwMakeWindowCurrent(window);
_glfwPlatformRefreshWindowParams(); _glfwPlatformRefreshWindowParams();
@ -610,6 +609,11 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
{ {
// The desired OpenGL version is greater than the actual version // The desired OpenGL version is greater than the actual version
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context // This only happens if the machine lacks {GLX|WGL}_ARB_create_context
// /and/ the user has requested an OpenGL version greater than 1.0
// For API consistency, we emulate the behavior of the
// {GLX|WGL}_ARB_create_context extension and fail here
glfwCloseWindow(window); glfwCloseWindow(window);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "glfwOpenWindow: The requested OpenGL version is not available"); _glfwSetError(GLFW_VERSION_UNAVAILABLE, "glfwOpenWindow: The requested OpenGL version is not available");
return GL_FALSE; return GL_FALSE;
@ -617,21 +621,28 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
if (window->glMajor > 2) if (window->glMajor > 2)
{ {
// OpenGL 3.0+ uses a different function for extension string retrieval
window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi"); window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
if (!window->GetStringi) if (!window->GetStringi)
{ {
// This is a very common problem among people who compile GLFW
// on X11/GLX using custom build systems, as it needs explicit
// configuration in order to work
glfwCloseWindow(window); glfwCloseWindow(window);
_glfwSetError(GLFW_PLATFORM_ERROR, "glfwOpenWindow: Entry point retrieval is broken; see the build documentation for your platform"); _glfwSetError(GLFW_PLATFORM_ERROR, "glfwOpenWindow: Entry point retrieval is broken; see the build documentation for your platform");
return GL_FALSE; return GL_FALSE;
} }
} }
// If full-screen mode was requested, disable mouse cursor // The GLFW specification states that fullscreen windows have the cursor
// locked by default
if (mode == GLFW_FULLSCREEN) if (mode == GLFW_FULLSCREEN)
glfwDisable(window, GLFW_MOUSE_CURSOR); glfwDisable(window, GLFW_MOUSE_CURSOR);
// Start by clearing the front buffer to black (avoid ugly desktop // Clearing the front buffer to black to avoid garbage pixels left over
// remains in our OpenGL window) // from previous uses of our bit of VRAM
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(); _glfwPlatformSwapBuffers();