2003-07-06 15:01:13 +00:00
|
|
|
#include <stdio.h>
|
2004-02-01 21:26:11 +00:00
|
|
|
#include <stdlib.h>
|
2003-07-06 15:01:13 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <GL/glew.h>
|
2014-06-24 15:03:28 +00:00
|
|
|
#if defined(GLEW_OSMESA)
|
|
|
|
#define GLAPI extern
|
|
|
|
#include <GL/osmesa.h>
|
|
|
|
#elif defined(_WIN32)
|
2003-07-06 15:01:13 +00:00
|
|
|
#include <GL/wglew.h>
|
2013-12-09 21:20:56 +00:00
|
|
|
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
2003-07-06 15:01:13 +00:00
|
|
|
#include <GL/glxew.h>
|
2003-09-26 13:49:28 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-29 10:08:13 +00:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
#include <AvailabilityMacros.h>
|
|
|
|
#endif
|
|
|
|
|
2012-07-23 21:19:50 +00:00
|
|
|
#ifdef GLEW_REGAL
|
|
|
|
#include <GL/Regal.h>
|
|
|
|
#endif
|
|
|
|
|
2003-07-06 15:01:13 +00:00
|
|
|
static FILE* f;
|
|
|
|
|
2004-05-09 09:08:20 +00:00
|
|
|
#ifdef GLEW_MX
|
2004-05-09 09:26:51 +00:00
|
|
|
GLEWContext _glewctx;
|
|
|
|
#define glewGetContext() (&_glewctx)
|
2015-10-09 23:26:00 +00:00
|
|
|
#if defined(_WIN32)
|
2004-05-09 09:26:51 +00:00
|
|
|
WGLEWContext _wglewctx;
|
|
|
|
#define wglewGetContext() (&_wglewctx)
|
2015-10-09 23:26:00 +00:00
|
|
|
#elif !defined(GLEW_OSMESA) && !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
2004-05-09 09:26:51 +00:00
|
|
|
GLXEWContext _glxewctx;
|
|
|
|
#define glxewGetContext() (&_glxewctx)
|
|
|
|
#endif
|
2004-05-09 09:08:20 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-29 10:29:08 +00:00
|
|
|
/* Command-line parameters for GL context creation */
|
|
|
|
|
|
|
|
struct createParams
|
|
|
|
{
|
2014-06-24 15:03:28 +00:00
|
|
|
#if defined(GLEW_OSMESA)
|
|
|
|
#elif defined(_WIN32)
|
2015-02-16 13:16:10 +00:00
|
|
|
int pixelformat;
|
2013-12-09 21:20:56 +00:00
|
|
|
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
2015-02-16 13:16:10 +00:00
|
|
|
const char* display;
|
|
|
|
int visual;
|
2004-02-02 02:25:18 +00:00
|
|
|
#endif
|
2015-05-29 10:29:08 +00:00
|
|
|
int major, minor; /* GL context version number */
|
|
|
|
|
|
|
|
/* https://www.opengl.org/registry/specs/ARB/glx_create_context.txt */
|
2015-05-29 10:45:19 +00:00
|
|
|
int profile; /* core = 1, compatibility = 2 */
|
2015-05-29 10:29:08 +00:00
|
|
|
int flags; /* debug = 1, forward compatible = 2 */
|
2015-02-16 13:16:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GLboolean glewCreateContext (struct createParams *params);
|
2004-02-02 02:25:18 +00:00
|
|
|
|
2015-02-16 13:16:10 +00:00
|
|
|
GLboolean glewParseArgs (int argc, char** argv, struct createParams *);
|
2004-02-02 02:30:43 +00:00
|
|
|
|
2003-09-26 13:49:28 +00:00
|
|
|
void glewDestroyContext ();
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2006-11-21 04:13:59 +00:00
|
|
|
static void glewPrintExt (const char* name, GLboolean def1, GLboolean def2, GLboolean def3)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
fprintf(f, "\n%s:", name);
|
2004-02-02 03:03:13 +00:00
|
|
|
for (i=0; i<62-strlen(name); i++) fprintf(f, " ");
|
2003-10-27 03:11:08 +00:00
|
|
|
fprintf(f, "%s ", def1 ? "OK" : "MISSING");
|
|
|
|
if (def1 != def2)
|
2006-11-21 04:13:59 +00:00
|
|
|
fprintf(f, "[%s] ", def2 ? "OK" : "MISSING");
|
|
|
|
if (def1 != def3)
|
|
|
|
fprintf(f, "[%s]\n", def3 ? "OK" : "MISSING");
|
2003-10-27 03:11:08 +00:00
|
|
|
else
|
|
|
|
fprintf(f, "\n");
|
2004-02-02 03:03:13 +00:00
|
|
|
for (i=0; i<strlen(name)+1; i++) fprintf(f, "-");
|
2003-07-06 15:01:13 +00:00
|
|
|
fprintf(f, "\n");
|
|
|
|
fflush(f);
|
|
|
|
}
|
|
|
|
|
2004-02-02 03:03:13 +00:00
|
|
|
static void glewInfoFunc (const char* name, GLint undefined)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
fprintf(f, " %s:", name);
|
2004-02-02 03:03:13 +00:00
|
|
|
for (i=0; i<60-strlen(name); i++) fprintf(f, " ");
|
2003-07-06 15:01:13 +00:00
|
|
|
fprintf(f, "%s\n", undefined ? "MISSING" : "OK");
|
|
|
|
fflush(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------- GL_VERSION_1_1 ---------------------------- */
|
|
|
|
|
|
|
|
#ifdef GL_VERSION_1_1
|
|
|
|
|
|
|
|
static void _glewInfo_GL_VERSION_1_1 (void)
|
|
|
|
{
|
2006-11-21 04:13:59 +00:00
|
|
|
glewPrintExt("GL_VERSION_1_1", GLEW_VERSION_1_1, GLEW_VERSION_1_1, GLEW_VERSION_1_1);
|
2003-07-06 15:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GL_VERSION_1_1 */
|
|
|
|
|