mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-23 15:15:05 +00:00
Generate Sources of origin/master updated at Sat Jun 13 17:44:26 GMT 2015
This commit is contained in:
parent
f5be4658cb
commit
3a183ac231
1352
src/glew.c
1352
src/glew.c
File diff suppressed because it is too large
Load Diff
266
src/glewinfo.c
266
src/glewinfo.c
@ -40,6 +40,10 @@
|
|||||||
#include <GL/glxew.h>
|
#include <GL/glxew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GLEW_REGAL
|
#ifdef GLEW_REGAL
|
||||||
#include <GL/Regal.h>
|
#include <GL/Regal.h>
|
||||||
#endif
|
#endif
|
||||||
@ -58,17 +62,26 @@ GLXEWContext _glxewctx;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
/* Command-line parameters for GL context creation */
|
||||||
GLboolean glewCreateContext (int* pixelformat);
|
|
||||||
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
|
||||||
GLboolean glewCreateContext (const char* display, int* visual);
|
|
||||||
#else
|
|
||||||
GLboolean glewCreateContext ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
struct createParams
|
||||||
GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual);
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
int pixelformat;
|
||||||
|
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
||||||
|
const char* display;
|
||||||
|
int visual;
|
||||||
#endif
|
#endif
|
||||||
|
int major, minor; /* GL context version number */
|
||||||
|
|
||||||
|
/* https://www.opengl.org/registry/specs/ARB/glx_create_context.txt */
|
||||||
|
int profile; /* core = 1, compatibility = 2 */
|
||||||
|
int flags; /* debug = 1, forward compatible = 2 */
|
||||||
|
};
|
||||||
|
|
||||||
|
GLboolean glewCreateContext (struct createParams *params);
|
||||||
|
|
||||||
|
GLboolean glewParseArgs (int argc, char** argv, struct createParams *);
|
||||||
|
|
||||||
void glewDestroyContext ();
|
void glewDestroyContext ();
|
||||||
|
|
||||||
@ -11076,36 +11089,40 @@ static void glxewInfo ()
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
#else
|
|
||||||
int main (void)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
GLuint err;
|
GLuint err;
|
||||||
|
struct createParams params =
|
||||||
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
|
||||||
char* display = NULL;
|
|
||||||
int visual = -1;
|
|
||||||
|
|
||||||
if (glewParseArgs(argc-1, argv+1, &display, &visual))
|
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
fprintf(stderr, "Usage: glewinfo [-pf <id>]\n");
|
-1, /* pixelformat */
|
||||||
#else
|
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
fprintf(stderr, "Usage: glewinfo [-display <display>] [-visual <id>]\n");
|
"", /* display */
|
||||||
|
-1, /* visual */
|
||||||
#endif
|
#endif
|
||||||
|
0, /* major */
|
||||||
|
0, /* minor */
|
||||||
|
0, /* profile mask */
|
||||||
|
0 /* flags */
|
||||||
|
};
|
||||||
|
|
||||||
|
if (glewParseArgs(argc-1, argv+1, ¶ms))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: glewinfo "
|
||||||
|
#if defined(_WIN32)
|
||||||
|
"[-pf <pixelformat>] "
|
||||||
|
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
|
"[-display <display>] "
|
||||||
|
"[-visual <visual id>] "
|
||||||
|
#endif
|
||||||
|
"[-version <OpenGL version>] "
|
||||||
|
"[-profile core|compatibility] "
|
||||||
|
"[-flag debug|forward]"
|
||||||
|
"\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
if (GL_TRUE == glewCreateContext(¶ms))
|
||||||
if (GL_TRUE == glewCreateContext(&visual))
|
|
||||||
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
|
||||||
if (GL_TRUE == glewCreateContext())
|
|
||||||
#else
|
|
||||||
if (GL_TRUE == glewCreateContext(display, &visual))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: glewCreateContext failed\n");
|
fprintf(stderr, "Error: glewCreateContext failed\n");
|
||||||
glewDestroyContext();
|
glewDestroyContext();
|
||||||
@ -11116,7 +11133,7 @@ int main (void)
|
|||||||
err = glewContextInit(glewGetContext());
|
err = glewContextInit(glewGetContext());
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
err = err || wglewContextInit(wglewGetContext());
|
err = err || wglewContextInit(wglewGetContext());
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
err = err || glxewContextInit(glxewGetContext());
|
err = err || glxewContextInit(glxewGetContext());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -11145,10 +11162,10 @@ int main (void)
|
|||||||
fprintf(f, "---------------------------\n\n");
|
fprintf(f, "---------------------------\n\n");
|
||||||
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
|
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
fprintf(f, "Reporting capabilities of pixelformat %d\n", visual);
|
fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat);
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n",
|
fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n",
|
||||||
display == NULL ? getenv("DISPLAY") : display, visual);
|
params.display == NULL ? getenv("DISPLAY") : params.display, params.visual);
|
||||||
#endif
|
#endif
|
||||||
fprintf(f, "Running on a %s from %s\n",
|
fprintf(f, "Running on a %s from %s\n",
|
||||||
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
||||||
@ -11166,39 +11183,55 @@ int main (void)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
|
||||||
GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual)
|
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
while (p < argc)
|
while (p < argc)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
if (!strcmp(argv[p], "-version"))
|
||||||
if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
|
|
||||||
{
|
{
|
||||||
if (++p >= argc) return GL_TRUE;
|
if (++p >= argc) return GL_TRUE;
|
||||||
*display = 0;
|
if (sscanf(argv[p++], "%d.%d", ¶ms->major, ¶ms->minor) != 2) return GL_TRUE;
|
||||||
*visual = strtol(argv[p++], NULL, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else if (!strcmp(argv[p], "-profile"))
|
||||||
return GL_TRUE;
|
|
||||||
#else
|
|
||||||
if (!strcmp(argv[p], "-display"))
|
|
||||||
{
|
{
|
||||||
if (++p >= argc) return GL_TRUE;
|
if (++p >= argc) return GL_TRUE;
|
||||||
*display = argv[p++];
|
if (strcmp("core", argv[p]) == 0) params->profile |= 1;
|
||||||
|
else if (strcmp("compatibility",argv[p]) == 0) params->profile |= 2;
|
||||||
|
else return GL_TRUE;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[p], "-flag"))
|
||||||
|
{
|
||||||
|
if (++p >= argc) return GL_TRUE;
|
||||||
|
if (strcmp("debug", argv[p]) == 0) params->flags |= 1;
|
||||||
|
else if (strcmp("forward",argv[p]) == 0) params->flags |= 2;
|
||||||
|
else return GL_TRUE;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
#if defined(_WIN32)
|
||||||
|
else if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
|
||||||
|
{
|
||||||
|
if (++p >= argc) return GL_TRUE;
|
||||||
|
params->pixelformat = strtol(argv[p++], NULL, 0);
|
||||||
|
}
|
||||||
|
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
|
else if (!strcmp(argv[p], "-display"))
|
||||||
|
{
|
||||||
|
if (++p >= argc) return GL_TRUE;
|
||||||
|
params->display = argv[p++];
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[p], "-visual"))
|
else if (!strcmp(argv[p], "-visual"))
|
||||||
{
|
{
|
||||||
if (++p >= argc) return GL_TRUE;
|
if (++p >= argc) return GL_TRUE;
|
||||||
*visual = (int)strtol(argv[p++], NULL, 0);
|
params->visual = (int)strtol(argv[p++], NULL, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
@ -11208,7 +11241,7 @@ HWND wnd = NULL;
|
|||||||
HDC dc = NULL;
|
HDC dc = NULL;
|
||||||
HGLRC rc = NULL;
|
HGLRC rc = NULL;
|
||||||
|
|
||||||
GLboolean glewCreateContext (int* pixelformat)
|
GLboolean glewCreateContext (struct createParams* params)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
@ -11227,20 +11260,58 @@ GLboolean glewCreateContext (int* pixelformat)
|
|||||||
if (NULL == dc) return GL_TRUE;
|
if (NULL == dc) return GL_TRUE;
|
||||||
/* find pixel format */
|
/* find pixel format */
|
||||||
ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
if (*pixelformat == -1) /* find default */
|
if (params->pixelformat == -1) /* find default */
|
||||||
{
|
{
|
||||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||||
pfd.nVersion = 1;
|
pfd.nVersion = 1;
|
||||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||||
*pixelformat = ChoosePixelFormat(dc, &pfd);
|
params->pixelformat = ChoosePixelFormat(dc, &pfd);
|
||||||
if (*pixelformat == 0) return GL_TRUE;
|
if (params->pixelformat == 0) return GL_TRUE;
|
||||||
}
|
}
|
||||||
/* set the pixel format for the dc */
|
/* set the pixel format for the dc */
|
||||||
if (FALSE == SetPixelFormat(dc, *pixelformat, &pfd)) return GL_TRUE;
|
if (FALSE == SetPixelFormat(dc, params->pixelformat, &pfd)) return GL_TRUE;
|
||||||
/* create rendering context */
|
/* create rendering context */
|
||||||
rc = wglCreateContext(dc);
|
rc = wglCreateContext(dc);
|
||||||
if (NULL == rc) return GL_TRUE;
|
if (NULL == rc) return GL_TRUE;
|
||||||
if (FALSE == wglMakeCurrent(dc, rc)) return GL_TRUE;
|
if (FALSE == wglMakeCurrent(dc, rc)) return GL_TRUE;
|
||||||
|
if (params->major || params->profile || params->flags)
|
||||||
|
{
|
||||||
|
HGLRC oldRC = rc;
|
||||||
|
int contextAttrs[20];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
extern GLenum GLEWAPIENTRY wglewContextInit();
|
||||||
|
wglewContextInit();
|
||||||
|
|
||||||
|
if (!wglewGetExtension("WGL_ARB_create_context_profile"))
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (params->major)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = WGL_CONTEXT_MAJOR_VERSION_ARB;
|
||||||
|
contextAttrs[i++] = params->major;
|
||||||
|
contextAttrs[i++] = WGL_CONTEXT_MINOR_VERSION_ARB;
|
||||||
|
contextAttrs[i++] = params->minor;
|
||||||
|
}
|
||||||
|
if (params->profile)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = WGL_CONTEXT_PROFILE_MASK_ARB;
|
||||||
|
contextAttrs[i++] = params->profile;
|
||||||
|
}
|
||||||
|
if (params->flags)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = WGL_CONTEXT_FLAGS_ARB;
|
||||||
|
contextAttrs[i++] = params->flags;
|
||||||
|
}
|
||||||
|
contextAttrs[i++] = 0;
|
||||||
|
rc = wglCreateContextAttribsARB(dc, 0, contextAttrs);
|
||||||
|
|
||||||
|
if (NULL == rc) return GL_TRUE;
|
||||||
|
if (!wglMakeCurrent(dc, rc)) return GL_TRUE;
|
||||||
|
|
||||||
|
wglDeleteContext(oldRC);
|
||||||
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11262,22 +11333,31 @@ void glewDestroyContext ()
|
|||||||
|
|
||||||
CGLContextObj ctx, octx;
|
CGLContextObj ctx, octx;
|
||||||
|
|
||||||
GLboolean glewCreateContext ()
|
GLboolean glewCreateContext (struct createParams *params)
|
||||||
{
|
{
|
||||||
const CGLPixelFormatAttribute attrib[4] =
|
CGLPixelFormatAttribute contextAttrs[20];
|
||||||
{
|
int i;
|
||||||
kCGLPFAAccelerated, /* No software rendering */
|
|
||||||
#if 0
|
|
||||||
kCGLPFAOpenGLProfile, /* OSX 10.7 Lion onwards */
|
|
||||||
(CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core, /* 3.2 Core Context */
|
|
||||||
#endif
|
|
||||||
0
|
|
||||||
};
|
|
||||||
CGLPixelFormatObj pf;
|
CGLPixelFormatObj pf;
|
||||||
GLint npix;
|
GLint npix;
|
||||||
CGLError error;
|
CGLError error;
|
||||||
|
|
||||||
error = CGLChoosePixelFormat(attrib, &pf, &npix);
|
i = 0;
|
||||||
|
contextAttrs[i++] = kCGLPFAAccelerated; /* No software rendering */
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
|
||||||
|
if (params->profile & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||||
|
{
|
||||||
|
if (params->major==3 && params->minor>=2)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = kCGLPFAOpenGLProfile; /* OSX 10.7 Lion onwards */
|
||||||
|
contextAttrs[i++] = (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core; /* 3.2 Core Context */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
contextAttrs[i++] = 0;
|
||||||
|
|
||||||
|
error = CGLChoosePixelFormat(contextAttrs, &pf, &npix);
|
||||||
if (error) return GL_TRUE;
|
if (error) return GL_TRUE;
|
||||||
error = CGLCreateContext(pf, NULL, &ctx);
|
error = CGLCreateContext(pf, NULL, &ctx);
|
||||||
if (error) return GL_TRUE;
|
if (error) return GL_TRUE;
|
||||||
@ -11302,7 +11382,7 @@ void glewDestroyContext ()
|
|||||||
|
|
||||||
#elif defined(__HAIKU__)
|
#elif defined(__HAIKU__)
|
||||||
|
|
||||||
GLboolean glewCreateContext ()
|
GLboolean glewCreateContext (struct createParams *params)
|
||||||
{
|
{
|
||||||
/* TODO: Haiku: We need to call C++ code here */
|
/* TODO: Haiku: We need to call C++ code here */
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -11324,22 +11404,22 @@ GLXContext ctx = NULL;
|
|||||||
Window wnd = 0;
|
Window wnd = 0;
|
||||||
Colormap cmap = 0;
|
Colormap cmap = 0;
|
||||||
|
|
||||||
GLboolean glewCreateContext (const char* display, int* visual)
|
GLboolean glewCreateContext (struct createParams *params)
|
||||||
{
|
{
|
||||||
int attrib[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
int attrib[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
||||||
int erb, evb;
|
int erb, evb;
|
||||||
XSetWindowAttributes swa;
|
XSetWindowAttributes swa;
|
||||||
/* open display */
|
/* open display */
|
||||||
dpy = XOpenDisplay(display);
|
dpy = XOpenDisplay(params->display);
|
||||||
if (NULL == dpy) return GL_TRUE;
|
if (NULL == dpy) return GL_TRUE;
|
||||||
/* query for glx */
|
/* query for glx */
|
||||||
if (!glXQueryExtension(dpy, &erb, &evb)) return GL_TRUE;
|
if (!glXQueryExtension(dpy, &erb, &evb)) return GL_TRUE;
|
||||||
/* choose visual */
|
/* choose visual */
|
||||||
if (*visual == -1)
|
if (params->visual == -1)
|
||||||
{
|
{
|
||||||
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib);
|
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib);
|
||||||
if (NULL == vi) return GL_TRUE;
|
if (NULL == vi) return GL_TRUE;
|
||||||
*visual = (int)XVisualIDFromVisual(vi->visual);
|
params->visual = (int)XVisualIDFromVisual(vi->visual);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -11347,7 +11427,7 @@ GLboolean glewCreateContext (const char* display, int* visual)
|
|||||||
vis = XGetVisualInfo(dpy, 0, NULL, &n_vis);
|
vis = XGetVisualInfo(dpy, 0, NULL, &n_vis);
|
||||||
for (i=0; i<n_vis; i++)
|
for (i=0; i<n_vis; i++)
|
||||||
{
|
{
|
||||||
if ((int)XVisualIDFromVisual(vis[i].visual) == *visual)
|
if ((int)XVisualIDFromVisual(vis[i].visual) == params->visual)
|
||||||
vi = &vis[i];
|
vi = &vis[i];
|
||||||
}
|
}
|
||||||
if (vi == NULL) return GL_TRUE;
|
if (vi == NULL) return GL_TRUE;
|
||||||
@ -11365,6 +11445,54 @@ GLboolean glewCreateContext (const char* display, int* visual)
|
|||||||
CWBorderPixel | CWColormap, &swa);
|
CWBorderPixel | CWColormap, &swa);
|
||||||
/* make context current */
|
/* make context current */
|
||||||
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
||||||
|
if (params->major || params->profile || params->flags)
|
||||||
|
{
|
||||||
|
GLXContext oldCtx = ctx;
|
||||||
|
GLXFBConfig *FBConfigs;
|
||||||
|
int FBConfigAttrs[] = { GLX_FBCONFIG_ID, 0, None };
|
||||||
|
int contextAttrs[20];
|
||||||
|
int nelems, i;
|
||||||
|
|
||||||
|
glxewContextInit();
|
||||||
|
|
||||||
|
if (!glxewGetExtension("GLX_ARB_create_context_profile"))
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
if (glXQueryContext(dpy, oldCtx, GLX_FBCONFIG_ID, &FBConfigAttrs[1]))
|
||||||
|
return GL_TRUE;
|
||||||
|
FBConfigs = glXChooseFBConfig(dpy, vi->screen, FBConfigAttrs, &nelems);
|
||||||
|
|
||||||
|
if (nelems < 1)
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (params->major)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
|
||||||
|
contextAttrs[i++] = params->major;
|
||||||
|
contextAttrs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
|
||||||
|
contextAttrs[i++] = params->minor;
|
||||||
|
}
|
||||||
|
if (params->profile)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
|
||||||
|
contextAttrs[i++] = params->profile;
|
||||||
|
}
|
||||||
|
if (params->flags)
|
||||||
|
{
|
||||||
|
contextAttrs[i++] = GLX_CONTEXT_FLAGS_ARB;
|
||||||
|
contextAttrs[i++] = params->flags;
|
||||||
|
}
|
||||||
|
contextAttrs[i++] = None;
|
||||||
|
ctx = glXCreateContextAttribsARB(dpy, *FBConfigs, NULL, True, contextAttrs);
|
||||||
|
|
||||||
|
if (NULL == ctx) return GL_TRUE;
|
||||||
|
if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE;
|
||||||
|
|
||||||
|
glXDestroyContext(dpy, oldCtx);
|
||||||
|
|
||||||
|
XFree(FBConfigs);
|
||||||
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user