29 # include <GL/wglew.h>
32 # ifndef ERROR_PROFILE_DOES_NOT_MATCH_DEVICE
33 # define ERROR_PROFILE_DOES_NOT_MATCH_DEVICE 0x7E7
42 bool win32_silent_chk(
bool result)
45 SetLastError(NO_ERROR);
51 bool win32_chk(
bool result,
const char *
file,
int line,
const char *text)
54 LPTSTR formattedMsg =
NULL;
56 DWORD
error = GetLastError();
65 switch (
error & 0x0000FFFF) {
66 case ERROR_INVALID_VERSION_ARB:
68 "The specified OpenGL version and feature set are either invalid or not supported.\n";
71 case ERROR_INVALID_PROFILE_ARB:
73 "The specified OpenGL profile and feature set are either invalid or not supported.\n";
76 case ERROR_INVALID_PIXEL_TYPE_ARB:
77 msg =
"The specified pixel type is invalid.\n";
80 case ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB:
82 (
"The device contexts specified are not compatible. "
83 "This can occur if the device contexts are managed by "
84 "different drivers or possibly on different graphics adapters.\n");
88 case ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV:
89 msg =
"The device context(s) and rendering context have non-matching affinity masks.\n";
92 case ERROR_MISSING_AFFINITY_MASK_NV:
93 msg =
"The rendering context does not have an affinity mask set.\n";
97 case ERROR_PROFILE_DOES_NOT_MATCH_DEVICE:
99 (
"The specified profile is intended for a device of a "
100 "different type than the specified device.\n");
104 count = FormatMessage((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
105 FORMAT_MESSAGE_IGNORE_INSERTS),
108 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
109 (LPTSTR)(&formattedMsg),
113 msg =
count > 0 ? formattedMsg :
"<no system message>\n";
120 "%s(%d):[%s] -> Win32 Error# (%lu): %s",
124 (
unsigned long)
error,
127 _ftprintf(stderr,
"Win32 Error# (%lu): %s", (
unsigned long)
error, msg);
130 SetLastError(NO_ERROR);
133 LocalFree(formattedMsg);
148 glClearColor(0.294, 0.294, 0.294, 0.000);
149 glClear(GL_COLOR_BUFFER_BIT);
150 glClearColor(0.000, 0.000, 0.000, 0.000);
static void initClearGL()
static void error(const char *str)