mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 12:02:00 +00:00
Removed some and clarified remaining GLFW error tokens.
This commit is contained in:
parent
419f9f17a1
commit
52546171d0
@ -353,15 +353,13 @@ extern "C" {
|
|||||||
/* glfwGetError/glfwErrorString tokens */
|
/* glfwGetError/glfwErrorString tokens */
|
||||||
#define GLFW_NO_ERROR 0
|
#define GLFW_NO_ERROR 0
|
||||||
#define GLFW_NOT_INITIALIZED 0x00070001
|
#define GLFW_NOT_INITIALIZED 0x00070001
|
||||||
#define GLFW_INVALID_ENUM 0x00070002
|
#define GLFW_NO_CURRENT_WINDOW 0x00070002
|
||||||
#define GLFW_INVALID_VALUE 0x00070003
|
#define GLFW_INVALID_ENUM 0x00070003
|
||||||
#define GLFW_OUT_OF_MEMORY 0x00070004
|
#define GLFW_INVALID_VALUE 0x00070004
|
||||||
#define GLFW_OPENGL_NOT_SUPPORTED 0x00070005
|
#define GLFW_OUT_OF_MEMORY 0x00070005
|
||||||
#define GLFW_NO_PIXEL_FORMAT 0x00070006
|
#define GLFW_OPENGL_UNAVAILABLE 0x00070006
|
||||||
#define GLFW_VIDEO_MODE_FAILED 0x00070007
|
#define GLFW_VERSION_UNAVAILABLE 0x00070007
|
||||||
#define GLFW_UNAVAILABLE_VERSION 0x00070008
|
#define GLFW_PLATFORM_ERROR 0x00070008
|
||||||
#define GLFW_NO_CURRENT_WINDOW 0x00070009
|
|
||||||
#define GLFW_INTERNAL_ERROR 0x0007000A
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -475,7 +475,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
// Fail if OpenGL 3.0 or above was requested
|
// Fail if OpenGL 3.0 or above was requested
|
||||||
if (wndconfig->glMajor > 2)
|
if (wndconfig->glMajor > 2)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_UNAVAILABLE_VERSION);
|
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
_glfwLibrary.NS.delegate = [[GLFWApplicationDelegate alloc] init];
|
_glfwLibrary.NS.delegate = [[GLFWApplicationDelegate alloc] init];
|
||||||
if (_glfwLibrary.NS.delegate == nil)
|
if (_glfwLibrary.NS.delegate == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
window->NS.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
|
window->NS.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
|
||||||
if (window->NS.delegate == nil)
|
if (window->NS.delegate == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
if (window->NSGL.pixelFormat == nil)
|
if (window->NSGL.pixelFormat == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NO_PIXEL_FORMAT);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
shareContext:share];
|
shareContext:share];
|
||||||
if (window->NSGL.context == nil)
|
if (window->NSGL.context == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/error.c
18
src/error.c
@ -79,24 +79,20 @@ GLFWAPI const char* glfwErrorString(int error)
|
|||||||
return "No error";
|
return "No error";
|
||||||
case GLFW_NOT_INITIALIZED:
|
case GLFW_NOT_INITIALIZED:
|
||||||
return "The GLFW library is not initialized";
|
return "The GLFW library is not initialized";
|
||||||
|
case GLFW_NO_CURRENT_WINDOW:
|
||||||
|
return "There is no current GLFW window";
|
||||||
case GLFW_INVALID_ENUM:
|
case GLFW_INVALID_ENUM:
|
||||||
return "Invalid argument for enum parameter";
|
return "Invalid argument for enum parameter";
|
||||||
case GLFW_INVALID_VALUE:
|
case GLFW_INVALID_VALUE:
|
||||||
return "Invalid value for parameter";
|
return "Invalid value for parameter";
|
||||||
case GLFW_OUT_OF_MEMORY:
|
case GLFW_OUT_OF_MEMORY:
|
||||||
return "Out of memory";
|
return "Out of memory";
|
||||||
case GLFW_OPENGL_NOT_SUPPORTED:
|
case GLFW_OPENGL_UNAVAILABLE:
|
||||||
return "OpenGL is not supported";
|
return "OpenGL is not available on this machine";
|
||||||
case GLFW_NO_PIXEL_FORMAT:
|
case GLFW_VERSION_UNAVAILABLE:
|
||||||
return "No matching framebuffer pixel format could be found";
|
|
||||||
case GLFW_VIDEO_MODE_FAILED:
|
|
||||||
return "Video mode setting failed";
|
|
||||||
case GLFW_UNAVAILABLE_VERSION:
|
|
||||||
return "The requested OpenGL version is unavailable";
|
return "The requested OpenGL version is unavailable";
|
||||||
case GLFW_NO_CURRENT_WINDOW:
|
case GLFW_PLATFORM_ERROR:
|
||||||
return "There is no current GLFW window";
|
return "A platform-specific error occurred";
|
||||||
case GLFW_INTERNAL_ERROR:
|
|
||||||
return "Internal GLFW library error";
|
|
||||||
default:
|
default:
|
||||||
// TODO: Set GLFW_INVALID_ENUM here?
|
// TODO: Set GLFW_INVALID_ENUM here?
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -184,7 +184,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NO_PIXEL_FORMAT);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,13 +324,13 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (!_glfw_DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
if (!_glfw_DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfw_SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
if (!_glfw_SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
attribs);
|
attribs);
|
||||||
if (!window->WGL.context)
|
if (!window->WGL.context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
window->WGL.context = wglCreateContext(window->WGL.DC);
|
window->WGL.context = wglCreateContext(window->WGL.DC);
|
||||||
if (!window->WGL.context)
|
if (!window->WGL.context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!wglShareLists(share, window->WGL.context))
|
if (!wglShareLists(share, window->WGL.context))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1082,7 +1082,7 @@ static ATOM registerWindowClass(void)
|
|||||||
classAtom = RegisterClass(&wc);
|
classAtom = RegisterClass(&wc);
|
||||||
if (!classAtom)
|
if (!classAtom)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,14 +1196,14 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (!window->Win32.handle)
|
if (!window->Win32.handle)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->WGL.DC = GetDC(window->Win32.handle);
|
window->WGL.DC = GetDC(window->Win32.handle);
|
||||||
if (!window->WGL.DC)
|
if (!window->WGL.DC)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ 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
|
||||||
glfwCloseWindow(window);
|
glfwCloseWindow(window);
|
||||||
_glfwSetError(GLFW_UNAVAILABLE_VERSION);
|
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
|||||||
if (!window->GetStringi)
|
if (!window->GetStringi)
|
||||||
{
|
{
|
||||||
glfwCloseWindow(window);
|
glfwCloseWindow(window);
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ static GLboolean initDisplay(void)
|
|||||||
if (!_glfwLibrary.X11.display)
|
if (!_glfwLibrary.X11.display)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to open X display\n");
|
fprintf(stderr, "Failed to open X display\n");
|
||||||
_glfwSetError(GLFW_OPENGL_NOT_SUPPORTED);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ static GLboolean initDisplay(void)
|
|||||||
if (!glXQueryExtension(_glfwLibrary.X11.display, NULL, NULL))
|
if (!glXQueryExtension(_glfwLibrary.X11.display, NULL, NULL))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GLX not supported\n");
|
fprintf(stderr, "GLX not supported\n");
|
||||||
_glfwSetError(GLFW_OPENGL_NOT_SUPPORTED);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ static GLboolean initDisplay(void)
|
|||||||
&_glfwLibrary.X11.glxMinor))
|
&_glfwLibrary.X11.glxMinor))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to query GLX version\n");
|
fprintf(stderr, "Unable to query GLX version\n");
|
||||||
_glfwSetError(GLFW_OPENGL_NOT_SUPPORTED);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
if (!window->GLX.has_GLX_SGIX_fbconfig)
|
if (!window->GLX.has_GLX_SGIX_fbconfig)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "GLXFBConfigs are not supported by the X server\n");
|
fprintf(stderr, "GLXFBConfigs are not supported by the X server\n");
|
||||||
_glfwSetError(GLFW_NO_PIXEL_FORMAT);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "No GLXFBConfigs returned\n");
|
fprintf(stderr, "No GLXFBConfigs returned\n");
|
||||||
_glfwSetError(GLFW_NO_PIXEL_FORMAT);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,7 +412,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "No GLXFBConfigs returned\n");
|
fprintf(stderr, "No GLXFBConfigs returned\n");
|
||||||
_glfwSetError(GLFW_NO_PIXEL_FORMAT);
|
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
|
|||||||
if (fbconfig == NULL)
|
if (fbconfig == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to retrieve the selected GLXFBConfig\n");
|
fprintf(stderr, "Unable to retrieve the selected GLXFBConfig\n");
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
|
|||||||
XFree(fbconfig);
|
XFree(fbconfig);
|
||||||
|
|
||||||
fprintf(stderr, "Unable to retrieve visual for GLXFBconfig\n");
|
fprintf(stderr, "Unable to retrieve visual for GLXFBconfig\n");
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "OpenGL profile requested but GLX_ARB_create_context_profile "
|
fprintf(stderr, "OpenGL profile requested but GLX_ARB_create_context_profile "
|
||||||
"is unavailable\n");
|
"is unavailable\n");
|
||||||
_glfwSetError(GLFW_UNAVAILABLE_VERSION);
|
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to create OpenGL context\n");
|
fprintf(stderr, "Unable to create OpenGL context\n");
|
||||||
// TODO: Handle all the various error codes here
|
// TODO: Handle all the various error codes here
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
if (!window->X11.handle)
|
if (!window->X11.handle)
|
||||||
{
|
{
|
||||||
// TODO: Handle all the various error codes here
|
// TODO: Handle all the various error codes here
|
||||||
_glfwSetError(GLFW_INTERNAL_ERROR);
|
_glfwSetError(GLFW_PLATFORM_ERROR);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user