Made error message tags more consistent.

This commit is contained in:
Camilla Berglund 2012-12-13 19:18:04 +01:00
parent 9a659c287e
commit 9c0e19adca
8 changed files with 23 additions and 32 deletions

View File

@ -85,8 +85,7 @@ int _glfwPlatformInit(void)
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
if (_glfwLibrary.NSGL.framework == NULL) if (_glfwLibrary.NSGL.framework == NULL)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR, "Failed to locate OpenGL framework");
"glfwInit: Failed to locate OpenGL framework");
return GL_FALSE; return GL_FALSE;
} }

View File

@ -731,7 +731,7 @@ static GLboolean createContext(_GLFWwindow* window,
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
{ {
_glfwSetError(GLFW_VERSION_UNAVAILABLE, _glfwSetError(GLFW_VERSION_UNAVAILABLE,
"Cocoa/NSOpenGL: NSOpenGL does not support OpenGL ES"); "NSOpenGL: This API does not support OpenGL ES");
return GL_FALSE; return GL_FALSE;
} }

View File

@ -255,7 +255,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
//======================================================================== //========================================================================
// Checks whether the client API part of the window config is sane // Checks whether the client API part of the window config is sane
// It blames glfwOpenWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
@ -263,8 +262,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
if (wndconfig->clientAPI != GLFW_OPENGL_API && if (wndconfig->clientAPI != GLFW_OPENGL_API &&
wndconfig->clientAPI != GLFW_OPENGL_ES_API) wndconfig->clientAPI != GLFW_OPENGL_ES_API)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM, "Invalid client API requested");
"glfwCreateWindow: Invalid client API requested");
return GL_FALSE; return GL_FALSE;
} }
@ -281,7 +279,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
// OpenGL 3.x series ended with version 3.3 // OpenGL 3.x series ended with version 3.3
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Invalid OpenGL version %i.%i requested", "Invalid OpenGL version %i.%i requested",
wndconfig->glMajor, wndconfig->glMinor); wndconfig->glMajor, wndconfig->glMinor);
return GL_FALSE; return GL_FALSE;
} }
@ -296,7 +294,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE) wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwCreateWindow: Invalid OpenGL profile requested"); "Invalid OpenGL profile requested");
return GL_FALSE; return GL_FALSE;
} }
@ -307,7 +305,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
// and above // and above
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Context profiles only exist for " "Context profiles only exist for "
"OpenGL version 3.2 and above"); "OpenGL version 3.2 and above");
return GL_FALSE; return GL_FALSE;
} }
@ -317,8 +315,8 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
{ {
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above // Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Forward compatibility only exist " "Forward compatibility only exist for OpenGL "
"for OpenGL version 3.0 and above"); "version 3.0 and above");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -333,7 +331,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
// OpenGL ES 2.x series ended with version 2.0 // OpenGL ES 2.x series ended with version 2.0
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Invalid OpenGL ES version %i.%i requested", "Invalid OpenGL ES version %i.%i requested",
wndconfig->glMajor, wndconfig->glMinor); wndconfig->glMajor, wndconfig->glMinor);
return GL_FALSE; return GL_FALSE;
} }
@ -346,8 +344,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
{ {
// OpenGL ES does not support profiles // OpenGL ES does not support profiles
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Context profiles are not supported " "Context profiles are not supported by OpenGL ES");
"by OpenGL ES");
return GL_FALSE; return GL_FALSE;
} }
@ -355,8 +352,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
{ {
// OpenGL ES does not support forward-compatibility // OpenGL ES does not support forward-compatibility
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Forward compatibility is not " "Forward compatibility is not supported by OpenGL ES");
"supported by OpenGL ES");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -367,8 +363,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET) wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET)
{ {
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwCreateWindow: Invalid OpenGL robustness mode " "Invalid OpenGL robustness mode requested");
"requested");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -379,7 +374,6 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
//======================================================================== //========================================================================
// Reads back context properties // Reads back context properties
// It blames glfwCreateWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwRefreshContextParams(void) GLboolean _glfwRefreshContextParams(void)
@ -404,7 +398,7 @@ GLboolean _glfwRefreshContextParams(void)
if (!window->GetStringi) if (!window->GetStringi)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR,
"glfwCreateWindow: Entry point retrieval is broken"); "Entry point retrieval is broken");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -483,7 +477,6 @@ GLboolean _glfwRefreshContextParams(void)
//======================================================================== //========================================================================
// Checks whether the current context fulfils the specified requirements // Checks whether the current context fulfils the specified requirements
// It blames glfwCreateWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig) GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
@ -501,8 +494,7 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
// For API consistency, we emulate the behavior of the // For API consistency, we emulate the behavior of the
// {GLX|WGL}_ARB_create_context extension and fail here // {GLX|WGL}_ARB_create_context extension and fail here
_glfwSetError(GLFW_VERSION_UNAVAILABLE, _glfwSetError(GLFW_VERSION_UNAVAILABLE, NULL);
"glfwCreateWindow: The requested OpenGL version is not available");
return GL_FALSE; return GL_FALSE;
} }

View File

@ -55,7 +55,7 @@ GLFWAPI void glfwSetGamma(float gamma)
if (gamma <= 0.f) if (gamma <= 0.f)
{ {
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwSetGamma: Gamma value must be greater than zero"); "Gamma value must be greater than zero");
return; return;
} }

View File

@ -294,7 +294,9 @@ static int createContext(_GLFWwindow* window,
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
{ {
// Request an explicitly versioned context // NOTE: Only request an explicitly versioned context when
// necessary, as explicitly requesting version 1.0 does not always
// return the highest available version
setGLXattrib(attribs, index, GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor); setGLXattrib(attribs, index, GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
setGLXattrib(attribs, index, GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor); setGLXattrib(attribs, index, GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);

View File

@ -323,7 +323,7 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key)
if (key < 0 || key > GLFW_KEY_LAST) if (key < 0 || key > GLFW_KEY_LAST)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwGetKey: The specified key is invalid"); "The specified key is invalid");
return GLFW_RELEASE; return GLFW_RELEASE;
} }
@ -355,7 +355,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button)
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwGetMouseButton: The specified mouse button is invalid"); "The specified mouse button is invalid");
return GLFW_RELEASE; return GLFW_RELEASE;
} }

View File

@ -51,7 +51,7 @@ int _glfwInitOpenGL(void)
if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0) if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR,
"Cocoa/NSGL: Failed to create context TLS"); "NSOpenGL: Failed to create context TLS");
return GL_FALSE; return GL_FALSE;
} }

View File

@ -265,15 +265,13 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN) if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM, "Invalid window mode");
"glfwCreateWindow: Invalid window mode");
return GL_FALSE; return GL_FALSE;
} }
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
{ {
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE, "Invalid window size");
"glfwCreateWindow: Invalid window size");
return GL_FALSE; return GL_FALSE;
} }