summaryrefslogtreecommitdiff
path: root/GL
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-04-27 21:19:21 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-04-27 21:19:21 +0000
commit596ca4e7e6cadca299214dc3396ce5c6f6d0fccc (patch)
treef378e9b064f5d7ac56cd9e62864214ed633c8803 /GL
parent4b7bde21a64ae03ada5d16434f5ae158f919e3e0 (diff)
rename winErrorMessage to glWinErrorMessage print GetLastError() if
FormatMessage fails. This will at least give some information if the 1024 byte buffer is to small for some messages
Diffstat (limited to 'GL')
-rwxr-xr-xGL/windows/indirect.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/GL/windows/indirect.c b/GL/windows/indirect.c
index 3577989b0..e5aa6fb08 100755
--- a/GL/windows/indirect.c
+++ b/GL/windows/indirect.c
@@ -73,7 +73,7 @@ static void glWinInitDebugSettings(void)
}
static char errorbuffer[1024];
-const char *winErrorMessage(void)
+const char *glWinErrorMessage(void)
{
if (!FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -85,7 +85,7 @@ const char *winErrorMessage(void)
sizeof(errorbuffer),
NULL ))
{
- snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error in FormatMessage!\n");
+ snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error in FormatMessage: %08x!\n", (unsigned)GetLastError());
}
return errorbuffer;
}
@@ -267,7 +267,7 @@ static HDC glWinMakeDC(__GLcontext *gc)
/*dc = GetWindowDC(gc->winInfo.hwnd);*/
if (dc == NULL)
- ErrorF("GetDC error: %s\n", winErrorMessage());
+ ErrorF("GetDC error: %s\n", glWinErrorMessage());
return dc;
}
@@ -286,7 +286,7 @@ static void unattach(__GLcontext *gc)
{
ret = wglDeleteContext(gc->ctx);
if (!ret)
- ErrorF("wglDeleteContext error: %s\n", winErrorMessage());
+ ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage());
gc->ctx = NULL;
}
@@ -294,7 +294,7 @@ static void unattach(__GLcontext *gc)
{
ret = DeleteObject(gc->winInfo.hrgn);
if (!ret)
- ErrorF("DeleteObject error: %s\n", winErrorMessage());
+ ErrorF("DeleteObject error: %s\n", glWinErrorMessage());
gc->winInfo.hrgn = NULL;
}
#endif
@@ -333,13 +333,13 @@ static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv)
gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd);
if (gc->pixelFormat == 0)
{
- ErrorF("ChoosePixelFormat error: %s\n", winErrorMessage());
+ ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage());
return;
}
ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd);
if (!ret) {
- ErrorF("SetPixelFormat error: %s\n", winErrorMessage());
+ ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage());
}
#if 0
@@ -347,7 +347,7 @@ static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv)
gc->ctx = wglCreateContext(dc);
if (gc->ctx == NULL) {
- ErrorF("wglCreateContext error: %s\n", winErrorMessage());
+ ErrorF("wglCreateContext error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return;
}
@@ -358,10 +358,10 @@ static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv)
/* copy all rendering states to the new context */
ret = wglCopyContext(old_ctx, gc->ctx, GL_ALL_ATTRIB_BITS);
if (!ret)
- ErrorF("wglCopyContext error: %s\n", winErrorMessage());
+ ErrorF("wglCopyContext error: %s\n", glWinErrorMessage());
ret = wglDeleteContext(old_ctx);
if (!ret)
- ErrorF("wglDeleteContext error: %s\n", winErrorMessage());
+ ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage());
}
#endif
@@ -411,7 +411,7 @@ static GLboolean glWinMakeCurrent(__GLcontext *gc)
/* GLWIN_DEBUG_MSG("Got HDC %p\n", dc);*/
ret = wglMakeCurrent(dc, gc->ctx);
if (!ret)
- ErrorF("glMakeCurrent error: %s\n", winErrorMessage());
+ ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return ret?GL_TRUE:GL_FALSE;
@@ -436,7 +436,7 @@ static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src,
ret = wglCopyContext(src->ctx, dst->ctx, mask);
if (!ret)
{
- ErrorF("wglCopyContext error: %s\n", winErrorMessage());
+ ErrorF("wglCopyContext error: %s\n", glWinErrorMessage());
return GL_FALSE;
}
@@ -451,7 +451,7 @@ static GLboolean glWinForceCurrent(__GLcontext *gc)
dc = glWinMakeDC(gc);
ret = wglMakeCurrent(dc, gc->ctx);
if (!ret)
- ErrorF("wglSetCurrent error: %s\n", winErrorMessage());
+ ErrorF("wglSetCurrent error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return ret?GL_TRUE:GL_FALSE;
@@ -670,7 +670,7 @@ static __GLinterface *glWinCreateContext(__GLimports *imports,
dc = CreateDC("DISPLAY",NULL,NULL,NULL);
if (dc == NULL)
{
- ErrorF("CreateDC error: %s\n", winErrorMessage());
+ ErrorF("CreateDC error: %s\n", glWinErrorMessage());
free(result);
return NULL;
}
@@ -693,7 +693,7 @@ static __GLinterface *glWinCreateContext(__GLimports *imports,
result->pixelFormat = ChoosePixelFormat(dc, &result->pfd);
if (result->pixelFormat == 0)
{
- ErrorF("ChoosePixelFormat error: %s\n", winErrorMessage());
+ ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage());
ReleaseDC(result->winInfo.hwnd, dc);
free(result);
return NULL;
@@ -703,7 +703,7 @@ static __GLinterface *glWinCreateContext(__GLimports *imports,
ret = SetPixelFormat(dc, result->pixelFormat, &result->pfd);
if (!ret) {
- ErrorF("SetPixelFormat error: %s\n", winErrorMessage());
+ ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage());
ReleaseDC(result->winInfo.hwnd, dc);
free(result);
return NULL;
@@ -713,7 +713,7 @@ static __GLinterface *glWinCreateContext(__GLimports *imports,
result->isAttached = 0;
if (result->ctx == NULL) {
- ErrorF("wglCreateContext error: %s\n", winErrorMessage());
+ ErrorF("wglCreateContext error: %s\n", glWinErrorMessage());
ReleaseDC(result->winInfo.hwnd, dc);
free(result);
return NULL;
@@ -1356,7 +1356,7 @@ static GLboolean glWinSwapBuffers(__GLXdrawablePrivate *glxPriv)
ret = SwapBuffers(dc);
if (!ret)
- ErrorF("SwapBuffers failed: %s\n", winErrorMessage());
+ ErrorF("SwapBuffers failed: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
if (!ret)