16# include <epoxy/wgl.h>
19# ifndef ERROR_PROFILE_DOES_NOT_MATCH_DEVICE
20# define ERROR_PROFILE_DOES_NOT_MATCH_DEVICE 0x7E7
24#ifdef WITH_OPENGL_BACKEND
38bool win32_silent_chk(
bool result)
41 SetLastError(NO_ERROR);
47bool win32_chk(
bool result,
const char *file,
int line,
const char *text)
50 LPTSTR formattedMsg =
nullptr;
52 DWORD error = GetLastError();
61 switch (error & 0x0000FFFF) {
62 case ERROR_INVALID_VERSION_ARB:
64 "The specified OpenGL version and feature set are either invalid or not supported.\n";
67 case ERROR_INVALID_PROFILE_ARB:
69 "The specified OpenGL profile and feature set are either invalid or not supported.\n";
72 case ERROR_INVALID_PIXEL_TYPE_ARB:
73 msg =
"The specified pixel type is invalid.\n";
76 case ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB:
78 (
"The device contexts specified are not compatible. "
79 "This can occur if the device contexts are managed by "
80 "different drivers or possibly on different graphics adapters.\n");
84 case ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV:
85 msg =
"The device context(s) and rendering context have non-matching affinity masks.\n";
88 case ERROR_MISSING_AFFINITY_MASK_NV:
89 msg =
"The rendering context does not have an affinity mask set.\n";
93 case ERROR_PROFILE_DOES_NOT_MATCH_DEVICE:
95 (
"The specified profile is intended for a device of a "
96 "different type than the specified device.\n");
100 count = FormatMessage((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
101 FORMAT_MESSAGE_IGNORE_INSERTS),
104 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
105 (LPTSTR)(&formattedMsg),
109 msg = count > 0 ? formattedMsg :
"<no system message>\n";
116 stderr,
"%s:%d: [%s] -> Win32 Error# (%lu): %s", file, line, text,
ulong(error), msg);
121 _ftprintf(stderr,
"Win32 Error# (%lu): %s",
ulong(error), msg);
124 SetLastError(NO_ERROR);
127 LocalFree(formattedMsg);
136#ifdef WITH_OPENGL_BACKEND
137void GHOST_Context::initClearGL()
139 glClearColor(0.294, 0.294, 0.294, 0.000);
140 glClear(GL_COLOR_BUFFER_BIT);
141 glClearColor(0.000, 0.000, 0.000, 0.000);
static GHOST_Context * getActiveDrawingContext()
static GHOST_IContext * getActiveDrawingContext()