24 #if defined(USE_OPENGL) && defined(USE_X11)
33 RENDER_OPENGL_MGLDEFINES_H
42 void *GlxHelper::createContext(
const unsigned long window,
48 Display *
const display =
static_cast<Display*
>(display0);
49 XSync(display,
false);
50 int (*handler)(Display *, XErrorEvent *) = XSetErrorHandler(ErrorHandler);
51 void *context = mglXGetCurrentContext();
55 ||
isGLNull(mglXCreateContextAttribs)
58 logger->
log(
"Can't change context, functions in driver "
60 XSetErrorHandler(handler);
65 logger->
log(
"Can't change context, because current "
66 "context not created");
67 XSetErrorHandler(handler);
72 GLX_RENDER_TYPE, GLX_RGBA_BIT,
81 GLXFBConfig *framebuffer_config = mglXChooseFBConfig(display,
82 DefaultScreen(display),
86 if (!framebuffer_config || !fbcount)
88 logger->
log(
"No correct fb profile found");
89 XSetErrorHandler(handler);
92 logger->
log(
"Found %d frame buffer contexts.", fbcount);
102 void *
const context2 = mglXCreateContextAttribs(display,
103 framebuffer_config[0], context,
true, attribs);
106 logger->
log(
"context %d.%d creation failed", major, minor);
107 XSetErrorHandler(handler);
111 XSync(display,
false);
112 XSetErrorHandler(handler);
114 if (!mglXMakeCurrent(display, window, context2))
116 mglXDestroyContext(display, context2);
117 logger->
log(
"make current context %d.%d failed", major, minor);
121 if (mglXGetCurrentContext() != context2)
123 mglXDestroyContext(display, context2);
124 logger->
log(
"context cant be changed to %d.%d.", major, minor);
130 logger->
log(
"Context for %d.%d created", major, minor);
134 bool GlxHelper::makeCurrent(
const unsigned long window,
140 return mglXMakeCurrent(
static_cast<Display*
>(display), window, context);
void log(const char *const log_text,...)
#define GLX_CONTEXT_MINOR_VERSION_ARB
#define GLX_CONTEXT_PROFILE_MASK_ARB
#define GLX_CONTEXT_MAJOR_VERSION_ARB