mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +00:00
fixed problems with WGL_{ARB,EXT}_extensions_string
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@117 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
644fa321b4
commit
ac0c6387e9
2
Makefile
2
Makefile
@ -32,7 +32,7 @@ GLEW_DEST ?= /usr
|
||||
|
||||
GLEW_MAJOR = 1
|
||||
GLEW_MINOR = 1
|
||||
GLEW_MICRO = 1
|
||||
GLEW_MICRO = 2
|
||||
GLEW_VERSION = $(GLEW_MAJOR).$(GLEW_MINOR).$(GLEW_MICRO)
|
||||
|
||||
TARDIR = ../glew-$(GLEW_VERSION)
|
||||
|
@ -6,20 +6,25 @@
|
||||
# General Public License Version 2 as published by the Free Software
|
||||
# Foundation or, at your option, any later version.
|
||||
|
||||
SHELL := bash
|
||||
REGISTRY := registry
|
||||
BIN := bin
|
||||
SRC := src
|
||||
CORE := core
|
||||
EXT := extensions
|
||||
BLACKLIST := blacklist
|
||||
GLEW_MAJOR = 1
|
||||
GLEW_MINOR = 1
|
||||
GLEW_MICRO = 2
|
||||
GLEW_VERSION = $(GLEW_MAJOR).$(GLEW_MINOR).$(GLEW_MICRO)
|
||||
|
||||
PARSE_SPEC := parse_spec.pl
|
||||
SHELL = bash
|
||||
REGISTRY = registry
|
||||
BIN = bin
|
||||
SRC = src
|
||||
CORE = core
|
||||
EXT = extensions
|
||||
BLACKLIST = blacklist
|
||||
|
||||
TOP := ..
|
||||
I.DEST := $(TOP)/include/GL
|
||||
S.DEST := $(TOP)/src
|
||||
D.DEST := $(TOP)/doc
|
||||
PARSE_SPEC = parse_spec.pl
|
||||
|
||||
TOP = ..
|
||||
I.DEST = $(TOP)/include/GL
|
||||
S.DEST = $(TOP)/src
|
||||
D.DEST = $(TOP)/doc
|
||||
|
||||
TARGETS = $(I.DEST)/glew.h $(I.DEST)/wglew.h $(I.DEST)/glxew.h $(S.DEST)/glew.c $(S.DEST)/glewinfo.c $(D.DEST)/glew.html $(D.DEST)/wglew.html $(D.DEST)/glxew.html
|
||||
|
||||
@ -84,6 +89,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
|
||||
$(BIN)/make_list.pl $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_post.c >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
sed -i -e "s/GLEW_VERSION_STRING/$(GLEW_MAJOR)\.$(GLEW_MINOR)\.$(GLEW_MICRO)/g" $@
|
||||
|
||||
$(S.DEST)/glewinfo.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glewinfo_pre.c $@
|
||||
|
@ -32,7 +32,7 @@ static int _glewStrSame (const char *a, const char *b, int n)
|
||||
* other extension names. Could use strtok() but the constant
|
||||
* string returned by glGetString might be in read-only memory.
|
||||
*/
|
||||
GLboolean glewGetExtension (const char *name)
|
||||
GLboolean glewGetExtension (const GLubyte *name)
|
||||
{
|
||||
char *p, *end;
|
||||
int len = _glewStrLen(name);
|
||||
|
@ -5,28 +5,38 @@
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
const char* glewGetErrorString (GLuint error)
|
||||
const GLubyte* glewGetErrorString (GLenum error)
|
||||
{
|
||||
static const char* _glewErrorString[] =
|
||||
static const GLubyte* _glewErrorString[] =
|
||||
{
|
||||
"no error",
|
||||
"missing GL version",
|
||||
"missing {ARB,EXT}_extensions_string",
|
||||
"GL 1.1 and up are not supported",
|
||||
"GLX 1.2 and up are not supported",
|
||||
"unknown error"
|
||||
};
|
||||
if (error > 5) error = 5;
|
||||
if (error > sizeof(_glewErrorString)) error = sizeof(_glewErrorString);
|
||||
return _glewErrorString[error];
|
||||
}
|
||||
|
||||
const GLubyte* glewGetString (GLenum name)
|
||||
{
|
||||
static const GLubyte* _glewString[] =
|
||||
{
|
||||
NULL,
|
||||
"GLEW_VERSION_STRING"
|
||||
};
|
||||
if (name > sizeof(_glewString)-1) return NULL;
|
||||
return _glewString[name];
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
GLboolean glewExperimental = GL_FALSE;
|
||||
|
||||
GLuint glewInit ()
|
||||
GLenum glewInit ()
|
||||
{
|
||||
GLuint r;
|
||||
GLenum r;
|
||||
if ( (r = _glewInit()) ) return r;
|
||||
#ifdef _WIN32
|
||||
return _wglewInit();
|
||||
|
@ -2,16 +2,20 @@
|
||||
|
||||
/* error codes */
|
||||
#define GLEW_OK 0
|
||||
#define GLEW_NO_ERROR 0
|
||||
#define GLEW_ERROR_NO_GL_VERSION 1 /* missing GL version */
|
||||
#define GLEW_ERROR_NO_EXTENSIONS_STRING 2 /* missing {ARB,EXT}_extensions_string */
|
||||
#define GLEW_ERROR_GL_VERSION_10_ONLY 3 /* GL 1.1 and up are not supported */
|
||||
#define GLEW_ERROR_GLX_VERSION_11_ONLY 4 /* GLX 1.2 and up are not supported */
|
||||
#define GLEW_ERROR_GL_VERSION_10_ONLY 2 /* GL 1.1 and up are not supported */
|
||||
#define GLEW_ERROR_GLX_VERSION_11_ONLY 3 /* GLX 1.2 and up are not supported */
|
||||
|
||||
/* string codes */
|
||||
#define GLEW_VERSION 1
|
||||
|
||||
/* API */
|
||||
GLEWAPI GLboolean glewExperimental;
|
||||
GLEWAPI GLuint glewInit ();
|
||||
GLEWAPI GLboolean glewGetExtension (const char* name);
|
||||
GLEWAPI const char* glewGetErrorString (GLuint error);
|
||||
GLEWAPI GLenum glewInit ();
|
||||
GLEWAPI GLboolean glewGetExtension (const GLubyte* name);
|
||||
GLEWAPI const GLubyte* glewGetErrorString (GLenum error);
|
||||
GLEWAPI const GLubyte* glewGetString (GLenum name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -48,28 +48,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void * __dlopenGetProcAddress(const GLubyte *procName)
|
||||
static void* __dlopenGetProcAddress (const GLubyte *procName)
|
||||
{
|
||||
static void *h = NULL;
|
||||
static void *gpa;
|
||||
static void *h = NULL;
|
||||
static void *gpa;
|
||||
|
||||
if (!h)
|
||||
{
|
||||
if (!(h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"E: GLEW failed to dlopen myself: %s.\nAbort.\n",
|
||||
dlerror());
|
||||
exit(100);
|
||||
}
|
||||
if (!h)
|
||||
{
|
||||
if (!(h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL))) return NULL;
|
||||
gpa = dlsym(h, "glXGetProcAddress");
|
||||
}
|
||||
|
||||
gpa = dlsym(h, "glXGetProcAddress");
|
||||
}
|
||||
|
||||
if (gpa != NULL)
|
||||
return ((void* (*)(const GLubyte*))gpa)(procName);
|
||||
else
|
||||
return dlsym(h, (const char *)procName);
|
||||
if (gpa != NULL)
|
||||
return ((void* (*)(const GLubyte*))gpa)(procName);
|
||||
else
|
||||
return dlsym(h, (const char *)procName);
|
||||
}
|
||||
#endif /* GLEW_NEEDS_CUSTOM_GET_PROCADDRESS */
|
||||
|
||||
|
@ -34,6 +34,4 @@ static GLuint _wglewInit ()
|
||||
WGLEW_ARB_extensions_string = wglGetExtensionsStringARB != NULL;
|
||||
_glewInit_WGL_EXT_extensions_string();
|
||||
WGLEW_EXT_extensions_string = wglGetExtensionsStringEXT != NULL;
|
||||
if (WGLEW_ARB_extensions_string == GL_FALSE &&
|
||||
WGLEW_EXT_extensions_string == GL_FALSE) return GLEW_ERROR_NO_EXTENSIONS_STRING;
|
||||
/* initialize extensions */
|
||||
|
@ -28,6 +28,7 @@ int main (int argc, char** argv)
|
||||
fprintf(f, "Running on a %s from %s\n",
|
||||
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
||||
fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION));
|
||||
fprintf(f, "GLEW version %s is supported\n", glewGetString(GLEW_VERSION));
|
||||
glewInfo();
|
||||
#ifdef _WIN32
|
||||
wglewInfo();
|
||||
|
Loading…
Reference in New Issue
Block a user