Added error callback.

This commit is contained in:
Camilla Berglund
2010-11-23 17:45:23 +01:00
parent 065c77190d
commit f1e7d7c0ea
17 changed files with 154 additions and 132 deletions
+14 -14
View File
@@ -184,14 +184,14 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
if (!count)
{
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
_glfwSetError(GLFW_OPENGL_UNAVAILABLE, "Win32/WGL: No pixel formats found");
return NULL;
}
result = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * count);
if (!result)
{
_glfwSetError(GLFW_OUT_OF_MEMORY);
_glfwSetError(GLFW_OUT_OF_MEMORY, "Win32/WGL: Failed to allocate _GLFWfbconfig array");
return NULL;
}
@@ -324,13 +324,13 @@ static GLboolean createContext(_GLFWwindow* window,
if (!_glfw_DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
{
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
_glfwSetError(GLFW_OPENGL_UNAVAILABLE, "Win32/WGL: Failed to retrieve PFD for selected pixel format");
return GL_FALSE;
}
if (!_glfw_SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
{
_glfwSetError(GLFW_OPENGL_UNAVAILABLE);
_glfwSetError(GLFW_OPENGL_UNAVAILABLE, "Win32/WGL: Failed to set selected pixel format");
return GL_FALSE;
}
@@ -368,14 +368,14 @@ static GLboolean createContext(_GLFWwindow* window,
if (!window->WGL.has_WGL_ARB_create_context_profile)
{
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "Win32/WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable");
return GL_FALSE;
}
if (wndconfig->glProfile == GLFW_OPENGL_ES2_PROFILE &&
!window->WGL.has_WGL_EXT_create_context_es2_profile)
{
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "Win32/WGL: OpenGL ES 2.x profile requested but WGL_EXT_create_context_es2_profile is unavailable");
return GL_FALSE;
}
@@ -397,7 +397,7 @@ static GLboolean createContext(_GLFWwindow* window,
attribs);
if (!window->WGL.context)
{
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "Win32/WGL: Failed to create OpenGL context");
return GL_FALSE;
}
}
@@ -406,7 +406,7 @@ static GLboolean createContext(_GLFWwindow* window,
window->WGL.context = wglCreateContext(window->WGL.DC);
if (!window->WGL.context)
{
_glfwSetError(GLFW_PLATFORM_ERROR);
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to create OpenGL context");
return GL_FALSE;
}
@@ -414,7 +414,7 @@ static GLboolean createContext(_GLFWwindow* window,
{
if (!wglShareLists(share, window->WGL.context))
{
_glfwSetError(GLFW_PLATFORM_ERROR);
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to enable sharing with specified OpenGL context");
return GL_FALSE;
}
}
@@ -1113,7 +1113,7 @@ static ATOM registerWindowClass(void)
classAtom = RegisterClass(&wc);
if (!classAtom)
{
_glfwSetError(GLFW_PLATFORM_ERROR);
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to register window class");
return 0;
}
@@ -1227,14 +1227,14 @@ static int createWindow(_GLFWwindow* window,
if (!window->Win32.handle)
{
_glfwSetError(GLFW_PLATFORM_ERROR);
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to create window");
return GL_FALSE;
}
window->WGL.DC = GetDC(window->Win32.handle);
if (!window->WGL.DC)
{
_glfwSetError(GLFW_PLATFORM_ERROR);
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to retrieve DC for window");
return GL_FALSE;
}
@@ -1352,7 +1352,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
{
if (!window->WGL.has_WGL_ARB_create_context)
{
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "Win32/WGL: A forward compatible or debug OpenGL context requested but WGL_ARB_create_context is unavailable");
return GL_FALSE;
}
@@ -1363,7 +1363,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
{
if (!window->WGL.has_WGL_ARB_create_context_profile)
{
_glfwSetError(GLFW_VERSION_UNAVAILABLE);
_glfwSetError(GLFW_VERSION_UNAVAILABLE, "Win32/WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable");
return GL_FALSE;
}