13 # include <GL/wglew.h>
16 # ifndef ERROR_PROFILE_DOES_NOT_MATCH_DEVICE
17 # define ERROR_PROFILE_DOES_NOT_MATCH_DEVICE 0x7E7
26 bool win32_silent_chk(
bool result)
29 SetLastError(NO_ERROR);
35 bool win32_chk(
bool result,
const char *
file,
int line,
const char *text)
38 LPTSTR formattedMsg =
NULL;
40 DWORD
error = GetLastError();
49 switch (
error & 0x0000FFFF) {
50 case ERROR_INVALID_VERSION_ARB:
52 "The specified OpenGL version and feature set are either invalid or not supported.\n";
55 case ERROR_INVALID_PROFILE_ARB:
57 "The specified OpenGL profile and feature set are either invalid or not supported.\n";
60 case ERROR_INVALID_PIXEL_TYPE_ARB:
61 msg =
"The specified pixel type is invalid.\n";
64 case ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB:
66 (
"The device contexts specified are not compatible. "
67 "This can occur if the device contexts are managed by "
68 "different drivers or possibly on different graphics adapters.\n");
72 case ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV:
73 msg =
"The device context(s) and rendering context have non-matching affinity masks.\n";
76 case ERROR_MISSING_AFFINITY_MASK_NV:
77 msg =
"The rendering context does not have an affinity mask set.\n";
81 case ERROR_PROFILE_DOES_NOT_MATCH_DEVICE:
83 (
"The specified profile is intended for a device of a "
84 "different type than the specified device.\n");
88 count = FormatMessage((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
89 FORMAT_MESSAGE_IGNORE_INSERTS),
92 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
93 (LPTSTR)(&formattedMsg),
97 msg =
count > 0 ? formattedMsg :
"<no system message>\n";
104 "%s(%d):[%s] -> Win32 Error# (%lu): %s",
108 (
unsigned long)
error,
111 _ftprintf(stderr,
"Win32 Error# (%lu): %s", (
unsigned long)
error, msg);
114 SetLastError(NO_ERROR);
117 LocalFree(formattedMsg);
132 glClearColor(0.294, 0.294, 0.294, 0.000);
133 glClear(GL_COLOR_BUFFER_BIT);
134 glClearColor(0.000, 0.000, 0.000, 0.000);
static void initClearGL()
static void error(const char *str)