mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +00:00
Version bump; added glewIsSupported; split source file, it is too big for VC7.1
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@319 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
7dab3791ff
commit
a576f04909
4
Makefile
4
Makefile
@ -31,8 +31,8 @@
|
||||
GLEW_DEST ?= /usr
|
||||
|
||||
GLEW_MAJOR = 1
|
||||
GLEW_MINOR = 2
|
||||
GLEW_MICRO = 6
|
||||
GLEW_MINOR = 3
|
||||
GLEW_MICRO = 0
|
||||
GLEW_VERSION = $(GLEW_MAJOR).$(GLEW_MINOR).$(GLEW_MICRO)
|
||||
|
||||
TARDIR = ../glew-$(GLEW_VERSION)
|
||||
|
102
auto/Makefile
102
auto/Makefile
@ -6,8 +6,8 @@
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
GLEW_MAJOR = 1
|
||||
GLEW_MINOR = 2
|
||||
GLEW_MICRO = 6
|
||||
GLEW_MINOR = 3
|
||||
GLEW_MICRO = 0
|
||||
GLEW_VERSION = $(GLEW_MAJOR).$(GLEW_MINOR).$(GLEW_MICRO)
|
||||
|
||||
SHELL = bash
|
||||
@ -27,7 +27,7 @@ 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 \
|
||||
TARGETS = $(I.DEST)/glew.h $(I.DEST)/wglew.h $(I.DEST)/glxew.h $(S.DEST)/glew_gl.c $(S.DEST)/glew_str.c $(S.DEST)/glew_wgl.c $(S.DEST)/glew_glx.c $(S.DEST)/glewinfo.c \
|
||||
$(D.DEST)/glew.html $(D.DEST)/wglew.html $(D.DEST)/glxew.html
|
||||
|
||||
all: $(TARGETS)
|
||||
@ -57,7 +57,7 @@ endif
|
||||
|
||||
$(I.DEST)/glew.h: $(EXT)/.dummy
|
||||
test -d $(I.DEST) || mkdir -p $(I.DEST)
|
||||
cp -f $(SRC)/glew_pre.h $@
|
||||
cp -f $(SRC)/glew_head.h $@
|
||||
$(BIN)/make_header.pl GLAPIENTRY GL $(CORE)/GL_VERSION* >> $@
|
||||
$(BIN)/make_header.pl GLAPIENTRY GL $(EXT)/GL_* >> $@
|
||||
echo -e "/* ------------------------------------------------------------------------- */\n\n#if defined(GLEW_MX) && defined(_WIN32)\n#define GLEW_FUN_EXPORT\n#else\n#define GLEW_FUN_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n" >> $@
|
||||
@ -69,19 +69,19 @@ $(I.DEST)/glew.h: $(EXT)/.dummy
|
||||
echo -e "\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
|
||||
perl -e 's/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/' -pi $@
|
||||
rm -f $@.bak
|
||||
cat $(SRC)/glew_post.h >> $@
|
||||
cat $(SRC)/glew_tail.h >> $@
|
||||
|
||||
$(I.DEST)/wglew.h: $(EXT)/.dummy
|
||||
cp -f $(SRC)/wglew_pre.h $@
|
||||
cp -f $(SRC)/wglew_head.h $@
|
||||
$(BIN)/make_header.pl WINAPI WGL $(EXT)/WGL_* >> $@
|
||||
echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define WGLEW_EXPORT\n#else\n#define WGLEW_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */" >> $@
|
||||
$(BIN)/make_struct_fun.pl WGLEW_EXPORT $(EXT)/WGL_* >> $@
|
||||
$(BIN)/make_struct_var.pl WGLEW_EXPORT $(EXT)/WGL_* >> $@
|
||||
echo -e "\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
|
||||
cat $(SRC)/wglew_post.h >> $@
|
||||
cat $(SRC)/wglew_tail.h >> $@
|
||||
|
||||
$(I.DEST)/glxew.h: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glxew_pre.h $@
|
||||
cp -f $(SRC)/glxew_head.h $@
|
||||
$(BIN)/make_header.pl '' GLX $(CORE)/GLX_VERSION* >> $@
|
||||
$(BIN)/make_header.pl '' GLX $(EXT)/GLX_* >> $@
|
||||
echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_EXPORT\n#else\n#define GLXEW_EXPORT extern\n#endif /* GLEW_MX */" >> $@
|
||||
@ -90,44 +90,64 @@ $(I.DEST)/glxew.h: $(EXT)/.dummy
|
||||
$(BIN)/make_struct_var.pl GLXEW_EXPORT $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@
|
||||
echo -e "\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
|
||||
perl -e 's/GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_2;/GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_EXPORT GLboolean __GLXEW_VERSION_1_2;/' -pi $@
|
||||
cat $(SRC)/glxew_post.h >> $@
|
||||
cat $(SRC)/glxew_tail.h >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
|
||||
$(S.DEST)/glew.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_pre.c $@
|
||||
$(S.DEST)/glew_gl.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_gl_head.c $@
|
||||
$(BIN)/make_def.pl GL $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@
|
||||
echo -e "\n#endif /* !_WIN32 || !GLEW_MX */\n" >> $@
|
||||
echo -e "#if defined(_WIN32) && !defined(GLEW_MX)" >> $@
|
||||
$(BIN)/make_def.pl WGL $(EXT)/WGL_* >> $@
|
||||
echo -e "\n#endif /* _WIN32 && !GLEW_MX */\n" >> $@
|
||||
echo -e "#if !(defined(_WIN32) || (defined(__APPLE__) && !defined(GLEW_APPLE_GLX)))" >> $@
|
||||
$(BIN)/make_def.pl GLX $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@
|
||||
echo -e "\n#endif /* !_WIN32 */\n" >> $@
|
||||
$(BIN)/make_init.pl GL $(CORE)/GL_VERSION* >> $@
|
||||
$(BIN)/make_init.pl GL $(EXT)/GL_* >> $@
|
||||
echo -e "#ifdef _WIN32\n" >> $@
|
||||
$(BIN)/make_init.pl WGL $(EXT)/WGL_* >> $@
|
||||
echo -e "#else /* _UNIX */\n\n" >> $@
|
||||
$(BIN)/make_init.pl GLX $(CORE)/GLX_VERSION* >> $@
|
||||
$(BIN)/make_init.pl GLX $(EXT)/GLX_* >> $@
|
||||
echo -e "#endif /* _WIN32 */\n" >> $@
|
||||
|
||||
cat $(SRC)/glew_gl.c >> $@
|
||||
cat $(SRC)/glew_gl_init.c >> $@
|
||||
$(BIN)/make_list.pl $(CORE)/GL_VERSION* | grep -v '\"GL_VERSION' >> $@
|
||||
$(BIN)/make_list.pl $(EXT)/GL_* >> $@
|
||||
cat $(SRC)/glew_wgl.c >> $@
|
||||
$(BIN)/make_list.pl $(EXT)/WGL_* >> $@
|
||||
cat $(SRC)/glew_glx.c >> $@
|
||||
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
|
||||
$(BIN)/make_list.pl $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_post.c >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
cat $(SRC)/glew_gl_tail.c >> $@
|
||||
# $(BIN)/fix_OML_sync_control.sh $@
|
||||
perl -e "s/GLEW_VERSION_STRING/$(GLEW_MAJOR)\.$(GLEW_MINOR)\.$(GLEW_MICRO)/g" -pi $@
|
||||
perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(GLEW_CONTEXT_ARG_VAR_INIT\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }/g" -pi $@
|
||||
rm -f $@.bak
|
||||
|
||||
$(S.DEST)/glew_wgl.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_wgl_head.c $@
|
||||
$(BIN)/make_def.pl WGL $(EXT)/WGL_* >> $@
|
||||
echo -e "\n#endif /* !GLEW_MX */\n" >> $@
|
||||
$(BIN)/make_init.pl WGL $(EXT)/WGL_* >> $@
|
||||
cat $(SRC)/glew_wgl_init.c >> $@
|
||||
$(BIN)/make_list.pl $(EXT)/WGL_* >> $@
|
||||
cat $(SRC)/glew_wgl_tail.c >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
rm -f $@.bak
|
||||
|
||||
$(S.DEST)/glew_glx.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_glx_head.c $@
|
||||
echo -e "#if !defined(__APPLE__) || defined(GLEW_APPLE_GLX)" >> $@
|
||||
$(BIN)/make_def.pl GLX $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@
|
||||
echo -e "\n#endif /* !__APPLE__ */\n" >> $@
|
||||
$(BIN)/make_init.pl GLX $(CORE)/GLX_VERSION* >> $@
|
||||
$(BIN)/make_init.pl GLX $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_glx_init.c >> $@
|
||||
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
|
||||
$(BIN)/make_list.pl $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_glx_tail.c >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
rm -f $@.bak
|
||||
|
||||
$(S.DEST)/glew_str.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_str_head.c $@
|
||||
$(BIN)/make_str.pl $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@
|
||||
cat $(SRC)/glew_str_wgl.c >> $@
|
||||
$(BIN)/make_str.pl $(EXT)/WGL_* >> $@
|
||||
cat $(SRC)/glew_str_glx.c >> $@
|
||||
$(BIN)/make_str.pl $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_str_tail.c >> $@
|
||||
# $(BIN)/fix_OML_sync_control.sh $@
|
||||
# perl -e "s/GLEW_VERSION_STRING/$(GLEW_MAJOR)\.$(GLEW_MINOR)\.$(GLEW_MICRO)/g" -pi $@
|
||||
# perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(GLEW_CONTEXT_ARG_VAR_INIT\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }/g" -pi $@
|
||||
rm -f $@.bak
|
||||
|
||||
|
||||
$(S.DEST)/glewinfo.c: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glewinfo_pre.c $@
|
||||
cp -f $(SRC)/glewinfo_head.c $@
|
||||
$(BIN)/make_info.pl $(CORE)/GL_VERSION* >> $@
|
||||
$(BIN)/make_info.pl $(EXT)/GL_* >> $@
|
||||
echo -e "#ifdef _WIN32\n" >> $@
|
||||
@ -145,23 +165,23 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy
|
||||
cat $(SRC)/glewinfo_glx.c >> $@
|
||||
$(BIN)/make_info_list.pl $(CORE)/GLX_VERSION* >> $@
|
||||
$(BIN)/make_info_list.pl $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glewinfo_post.c >> $@
|
||||
cat $(SRC)/glewinfo_tail.c >> $@
|
||||
$(BIN)/fix_OML_sync_control.sh $@
|
||||
|
||||
$(D.DEST)/glew.html: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glew_pre.html $@
|
||||
cp -f $(SRC)/glew_head.html $@
|
||||
$(BIN)/make_html.pl $(EXT)/GL_* >> $@
|
||||
cat $(SRC)/glew_post.html >> $@
|
||||
cat $(SRC)/glew_tail.html >> $@
|
||||
|
||||
$(D.DEST)/wglew.html: $(EXT)/.dummy
|
||||
cp -f $(SRC)/wglew_pre.html $@
|
||||
cp -f $(SRC)/wglew_head.html $@
|
||||
$(BIN)/make_html.pl $(EXT)/WGL_* >> $@
|
||||
cat $(SRC)/glew_post.html >> $@
|
||||
cat $(SRC)/glew_tail.html >> $@
|
||||
|
||||
$(D.DEST)/glxew.html: $(EXT)/.dummy
|
||||
cp -f $(SRC)/glxew_pre.html $@
|
||||
cp -f $(SRC)/glxew_head.html $@
|
||||
$(BIN)/make_html.pl $(EXT)/GLX_* >> $@
|
||||
cat $(SRC)/glew_post.html >> $@
|
||||
cat $(SRC)/glew_tail.html >> $@
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGETS)
|
||||
|
@ -43,8 +43,8 @@ foreach my $ext (sort @extlist)
|
||||
$extpre =~ s/(GLX|GLW|GL).*/$1/;
|
||||
$extpre = lc $extpre;
|
||||
|
||||
make_separator($extname);
|
||||
print "#ifdef $extname\n\n";
|
||||
#make_separator($extname);
|
||||
#print "#ifdef $extname\n\n";
|
||||
print "static void _glewInfo_$extname (void)\n{\n";
|
||||
if ($extvar =~ /VERSION/)
|
||||
{
|
||||
@ -57,5 +57,5 @@ foreach my $ext (sort @extlist)
|
||||
}
|
||||
output_decls($functions, \&make_pfn_info);
|
||||
print "}\n\n";
|
||||
print "#endif /* $extname */\n\n";
|
||||
#print "#endif /* $extname */\n\n";
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ foreach my $ext (sort @extlist)
|
||||
my ($extname, $exturl, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
make_separator($extname);
|
||||
print "#ifdef $extname\n\n";
|
||||
#make_separator($extname);
|
||||
#print "#ifdef $extname\n\n";
|
||||
my $extvar = $extname;
|
||||
my $extvardef = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
@ -51,8 +51,8 @@ foreach my $ext (sort @extlist)
|
||||
print "static GLboolean _glewInit_$extname (" . $type .
|
||||
"EW_CONTEXT_ARG_DEF_INIT)\n{\n GLboolean r = GL_FALSE;\n";
|
||||
output_decls($functions, \&make_pfn_def_init);
|
||||
print "\n return r;\n}\n";
|
||||
print "\n return r;\n}\n\n";
|
||||
}
|
||||
#print "\nGLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n\n";
|
||||
print "#endif /* $extname */\n\n";
|
||||
#print "#endif /* $extname */\n\n";
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ foreach my $ext (sort @extlist)
|
||||
|
||||
#my $pextvar = prefix_varname($extvar);
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
#print "#ifdef $extname\n";
|
||||
print " " . $extvar . " = " . $extpre . "GetExtension(\"$extname\");\n";
|
||||
if (keys %$functions)
|
||||
{
|
||||
@ -59,5 +59,5 @@ foreach my $ext (sort @extlist)
|
||||
print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
}
|
||||
}
|
||||
print "#endif /* $extname */\n";
|
||||
#print "#endif /* $extname */\n";
|
||||
}
|
||||
|
53
auto/bin/make_str.pl
Executable file
53
auto/bin/make_str.pl
Executable file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/perl
|
||||
##
|
||||
## Copyright (C) 2004, 2003 Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
## Copyright (C) 2004, 2003 Milan Ikits <milan ikits[at]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
do 'bin/make.pl';
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $export = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
} else {
|
||||
local $/;
|
||||
@extlist = split "\n", (<>);
|
||||
}
|
||||
|
||||
my $curexttype = "";
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
my $exttype = $extname;
|
||||
$exttype =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$3/;
|
||||
my $extrem = $extname;
|
||||
$extrem =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$4/;
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/(W*)GL(X*)_/$1GL$2EW_/;
|
||||
if(!($exttype =~ $curexttype))
|
||||
{
|
||||
if(length($curexttype) > 0)
|
||||
{
|
||||
print " }\n";
|
||||
}
|
||||
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
|
||||
print " {\n";
|
||||
$curexttype = $exttype;
|
||||
}
|
||||
print " if (_glewStrSame3(pos, len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
|
||||
print " return $extvar;\n";
|
||||
}
|
||||
|
||||
print " }\n";
|
36
auto/src/glew_gl_head.c
Normal file
36
auto/src/glew_gl_head.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
** Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "glew_utils.h"
|
||||
|
||||
#if !defined(_WIN32) || !defined(GLEW_MX)
|
||||
|
||||
GLboolean __GLEW_VERSION_1_1 = GL_FALSE;
|
@ -1,31 +1,5 @@
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||
* These functions implement the functionality required in this file.
|
||||
*/
|
||||
|
||||
static GLuint _glewStrLen (const GLubyte* s)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0') i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0' && s[i] != c) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (i < n && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
||||
return i == n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for name in the extensions string. Use of strstr()
|
||||
* is not sufficient because extension names can be prefixes of
|
@ -36,6 +36,12 @@ GLboolean glewExperimental = GL_FALSE;
|
||||
|
||||
#ifndef GLEW_MX
|
||||
|
||||
#if defined(_WIN32)
|
||||
extern GLenum wglewContextInit (void);
|
||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
|
||||
extern GLenum glxewContextInit (void);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
GLenum glewInit ()
|
||||
{
|
||||
GLenum r;
|
36
auto/src/glew_glx_head.c
Normal file
36
auto/src/glew_glx_head.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
** Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "glew_utils.h"
|
||||
|
||||
GLboolean __GLXEW_VERSION_1_0 = GL_FALSE;
|
||||
GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;
|
||||
|
@ -1,7 +1,5 @@
|
||||
return GLEW_OK;
|
||||
}
|
||||
|
||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
|
||||
#if !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
|
||||
|
||||
GLboolean glxewGetExtension (const char* name)
|
||||
{
|
||||
@ -23,35 +21,33 @@ GLboolean glxewGetExtension (const char* name)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#ifndef GLEW_MX
|
||||
static
|
||||
#endif
|
||||
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
||||
{
|
||||
int major, minor;
|
||||
/* initialize core GLX 1.2 */
|
||||
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
/* initialize flags */
|
||||
GLXEW_VERSION_1_0 = GL_FALSE;
|
||||
GLXEW_VERSION_1_1 = GL_FALSE;
|
||||
GLXEW_VERSION_1_2 = GL_FALSE;
|
||||
GLXEW_VERSION_1_3 = GL_FALSE;
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
GLXEW_VERSION_1_0 = GL_TRUE;
|
||||
GLXEW_VERSION_1_1 = GL_TRUE;
|
||||
GLXEW_VERSION_1_2 = GL_TRUE;
|
||||
GLXEW_VERSION_1_3 = GL_TRUE;
|
||||
GLXEW_VERSION_1_4 = GL_TRUE;
|
||||
/* query GLX version */
|
||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
||||
switch (minor)
|
||||
if (major == 1 && minor <= 3)
|
||||
{
|
||||
case 4:
|
||||
GLXEW_VERSION_1_4 = GL_TRUE;
|
||||
case 3:
|
||||
GLXEW_VERSION_1_3 = GL_TRUE;
|
||||
case 2:
|
||||
GLXEW_VERSION_1_2 = GL_TRUE;
|
||||
GLXEW_VERSION_1_1 = GL_TRUE;
|
||||
GLXEW_VERSION_1_0 = GL_TRUE;
|
||||
break;
|
||||
default:
|
||||
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
break;
|
||||
switch (minor)
|
||||
{
|
||||
case 3:
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
break;
|
||||
case 2:
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
GLXEW_VERSION_1_3 = GL_FALSE;
|
||||
break;
|
||||
default:
|
||||
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* initialize extensions */
|
2
auto/src/glew_glx_tail.c
Normal file
2
auto/src/glew_glx_tail.c
Normal file
@ -0,0 +1,2 @@
|
||||
return GLEW_OK;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/* ---------------------------- GLX_VERSION_1_0 ---------------------------- */
|
||||
|
||||
#ifdef GLX_VERSION_1_0
|
||||
|
||||
GLboolean GLXEW_VERSION_1_0 = GL_FALSE;
|
||||
|
||||
#endif /* GLX_VERSION_1_0 */
|
||||
|
||||
/* ---------------------------- GLX_VERSION_1_1 ---------------------------- */
|
||||
|
||||
#ifdef GLX_VERSION_1_1
|
||||
|
||||
GLboolean GLXEW_VERSION_1_1 = GL_FALSE;
|
||||
|
||||
#endif /* GLX_VERSION_1_1 */
|
||||
|
4
auto/src/glew_str_glx.c
Normal file
4
auto/src/glew_str_glx.c
Normal file
@ -0,0 +1,4 @@
|
||||
}
|
||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
else if(_glewStrSame2(&pos, &len, (const GLubyte*)"GLX_", 4))
|
||||
{
|
43
auto/src/glew_str_head.c
Normal file
43
auto/src/glew_str_head.c
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
** Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "glew_utils.h"
|
||||
|
||||
#ifdef GLEW_MX
|
||||
GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name)
|
||||
#else
|
||||
GLboolean glewIsSupported (const char* name)
|
||||
#endif
|
||||
{
|
||||
GLubyte* pos = (GLubyte*)name;
|
||||
GLuint len = _glewStrLen(pos);
|
||||
if(_glewStrSame2(&pos, &len, (const GLubyte*)"GL_", 3))
|
||||
{
|
4
auto/src/glew_str_tail.c
Normal file
4
auto/src/glew_str_tail.c
Normal file
@ -0,0 +1,4 @@
|
||||
}
|
||||
#endif /* */
|
||||
return GL_FALSE;
|
||||
}
|
4
auto/src/glew_str_wgl.c
Normal file
4
auto/src/glew_str_wgl.c
Normal file
@ -0,0 +1,4 @@
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
else if(_glewStrSame2(&pos, &len, (const GLubyte*)"WGL_", 4))
|
||||
{
|
@ -15,6 +15,10 @@
|
||||
|
||||
typedef struct GLEWContextStruct GLEWContext;
|
||||
GLEWAPI GLenum glewContextInit (GLEWContext* ctx);
|
||||
GLEWAPI GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name);
|
||||
|
||||
#define glewInit() glewContextInit(glewGetContext())
|
||||
#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)
|
||||
|
||||
#ifdef _WIN32
|
||||
# define GLEW_GET_VAR(x) glewGetContext()->x
|
||||
@ -27,6 +31,7 @@ GLEWAPI GLenum glewContextInit (GLEWContext* ctx);
|
||||
#else /* GLEW_MX */
|
||||
|
||||
GLEWAPI GLenum glewInit ();
|
||||
GLEWAPI GLboolean glewIsSupported (const char* name);
|
||||
|
||||
#define GLEW_GET_VAR(x) x
|
||||
#define GLEW_GET_FUN(x) x
|
34
auto/src/glew_wgl_head.c
Normal file
34
auto/src/glew_wgl_head.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
** Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "glew_utils.h"
|
||||
|
||||
#if !defined(GLEW_MX)
|
@ -1,10 +1,6 @@
|
||||
return GLEW_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL;
|
||||
static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL;
|
||||
|
||||
@ -31,9 +27,6 @@ GLboolean wglewGetExtension (const char* name)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#ifndef GLEW_MX
|
||||
static
|
||||
#endif
|
||||
GLenum wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST)
|
||||
{
|
||||
GLboolean crippled;
|
2
auto/src/glew_wgl_tail.c
Normal file
2
auto/src/glew_wgl_tail.c
Normal file
@ -0,0 +1,2 @@
|
||||
return GLEW_OK;
|
||||
}
|
23
auto/src/wglew_tail.html
Normal file
23
auto/src/wglew_tail.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!--
|
||||
Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
This documentation may not be modified or redistributed in any
|
||||
form, except by the copyright holder.
|
||||
-->
|
||||
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/TR/html/4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
GLEW: WGL Extensions Supported
|
||||
</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=US-ASCII">
|
||||
<link href="glew.css" type=text/css rel=stylesheet>
|
||||
</head>
|
||||
<body bgcolor="#fff0d0">
|
||||
<center>
|
||||
<table border="0" width="50%" cellpadding="5" cellspacing="10">
|
||||
<tr>
|
||||
<td align="left" bgcolor="#ffffff">
|
||||
<center><font size="+1"><b>The OpenGL Extension Wrangler
|
||||
Library</b></font><p>
|
||||
<font size="+1">WGL Extensions Supported</font></center><p>
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2004, 2003, 2002, Milan Ikits <milan ikits[at]ieee org>
|
||||
** Copyright (C) 2004, 2003, 2002, Marcelo E. Magallon <mmagallo[at]debian org>
|
||||
** Copyright (C) 2002-2005, Milan Ikits <milan ikits[]ieee org>
|
||||
** Copyright (C) 2002-2005, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
@ -36,32 +36,20 @@
|
||||
# include <GL/glxew.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
||||
#else
|
||||
# if defined(__APPLE__)
|
||||
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
|
||||
# else
|
||||
# if defined(__sgi) || defined(__sun)
|
||||
# define glewGetProcAddress(name) dlGetProcAddress(name)
|
||||
# else /* __linux */
|
||||
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#include "glew_utils.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void *NSGLGetProcAddress (const GLubyte *name)
|
||||
void* NSGLGetProcAddress (const GLubyte *name)
|
||||
{
|
||||
NSSymbol symbol;
|
||||
char *symbolName;
|
||||
char* symbolName;
|
||||
/* prepend a '_' for the Unix C symbol mangling convention */
|
||||
symbolName = malloc(strlen((const char *)name) + 2);
|
||||
strcpy(symbolName+1, (const char *)name);
|
||||
symbolName = malloc(strlen((const char*)name) + 2);
|
||||
strcpy(symbolName+1, (const char*)name);
|
||||
symbolName[0] = '_';
|
||||
symbol = NULL;
|
||||
if (NSIsSymbolNameDefined(symbolName))
|
||||
@ -76,10 +64,10 @@ static void *NSGLGetProcAddress (const GLubyte *name)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void *dlGetProcAddress (const GLubyte* name)
|
||||
void* dlGetProcAddress (const GLubyte* name)
|
||||
{
|
||||
static void *h = NULL;
|
||||
static void *gpa;
|
||||
static void* h = NULL;
|
||||
static void* gpa;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
@ -88,43 +76,61 @@ static void *dlGetProcAddress (const GLubyte* name)
|
||||
}
|
||||
|
||||
if (gpa != NULL)
|
||||
return ((void *(*)(const GLubyte *))gpa)(name);
|
||||
return ((void*(*)(const GLubyte*))gpa)(name);
|
||||
else
|
||||
return dlsym(h, (const char *)name);
|
||||
return dlsym(h, (const char*)name);
|
||||
}
|
||||
#endif /* __sgi || __sun */
|
||||
|
||||
#ifdef GLEW_MX
|
||||
#define glewGetContext() ctx
|
||||
#define wglewGetContext() ctx
|
||||
#define glxewGetContext() ctx
|
||||
#ifdef _WIN32
|
||||
#define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
|
||||
#define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
|
||||
#define GLXEW_CONTEXT_ARG_DEF_INIT GLXEWContext* ctx
|
||||
#define GLEW_CONTEXT_ARG_VAR_INIT ctx
|
||||
#else /* _WIN32 */
|
||||
#define GLEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define WGLEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define GLXEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define GLEW_CONTEXT_ARG_VAR_INIT
|
||||
#endif /* _WIN32 */
|
||||
#define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
|
||||
#define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
|
||||
#define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
|
||||
#else /* GLEW_MX */
|
||||
#define GLEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define WGLEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define GLXEW_CONTEXT_ARG_DEF_INIT void
|
||||
#define GLEW_CONTEXT_ARG_DEF_LIST void
|
||||
#define WGLEW_CONTEXT_ARG_DEF_LIST void
|
||||
#define GLXEW_CONTEXT_ARG_DEF_LIST void
|
||||
#define GLEW_CONTEXT_ARG_VAR_INIT
|
||||
#endif /* GLEW_MX */
|
||||
/*
|
||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||
* These functions implement the functionality required in this file.
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) || !defined(GLEW_MX)
|
||||
GLuint _glewStrLen (const GLubyte* s)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0') i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
GLboolean __GLEW_VERSION_1_1 = GL_FALSE;
|
||||
GLboolean __GLXEW_VERSION_1_0 = GL_FALSE;
|
||||
GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;
|
||||
GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0' && s[i] != c) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (i < n && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
||||
return i == n ? GL_TRUE : GL_FALSE;
|
||||
}
|
||||
|
||||
GLboolean _glewStrSame2 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
|
||||
{
|
||||
if(*na >= nb)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
|
||||
if(i == nb)
|
||||
{
|
||||
*a = *a + nb;
|
||||
*na = *na - nb;
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
GLboolean _glewStrSame3 (const GLubyte* a, GLuint na, const GLubyte* b, GLuint nb)
|
||||
{
|
||||
if(na == nb)
|
||||
{
|
||||
GLuint i=0;
|
||||
while (i < nb && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
||||
return i == nb ? GL_TRUE : GL_FALSE;
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
99
src/glew_utils.h
Normal file
99
src/glew_utils.h
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2002-2005, Milan Ikits <milan ikits[]ieee org>
|
||||
** Copyright (C) 2002-2005, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __glew_utils_h__
|
||||
#define __glew_utils_h__
|
||||
|
||||
#include <GL/glew.h>
|
||||
#if defined(_WIN32)
|
||||
# include <GL/wglew.h>
|
||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
# include <GL/glxew.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define glewGetContext and related helper macros.
|
||||
*/
|
||||
#ifdef GLEW_MX
|
||||
# define glewGetContext() ctx
|
||||
# ifdef _WIN32
|
||||
# define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
|
||||
# define GLEW_CONTEXT_ARG_VAR_INIT ctx
|
||||
# define wglewGetContext() ctx
|
||||
# define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
|
||||
# define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
|
||||
# else /* _WIN32 */
|
||||
# define GLEW_CONTEXT_ARG_DEF_INIT void
|
||||
# define GLEW_CONTEXT_ARG_VAR_INIT
|
||||
# define glxewGetContext() ctx
|
||||
# define GLXEW_CONTEXT_ARG_DEF_INIT void
|
||||
# define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
|
||||
# endif /* _WIN32 */
|
||||
# define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
|
||||
#else /* GLEW_MX */
|
||||
# define GLEW_CONTEXT_ARG_DEF_INIT void
|
||||
# define GLEW_CONTEXT_ARG_VAR_INIT
|
||||
# define GLEW_CONTEXT_ARG_DEF_LIST void
|
||||
# define WGLEW_CONTEXT_ARG_DEF_INIT void
|
||||
# define WGLEW_CONTEXT_ARG_DEF_LIST void
|
||||
# define GLXEW_CONTEXT_ARG_DEF_INIT void
|
||||
# define GLXEW_CONTEXT_ARG_DEF_LIST void
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
/*
|
||||
* Define glewGetProcAddress.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
||||
#else
|
||||
# if defined(__APPLE__)
|
||||
extern void* NSGLGetProcAddress (const GLubyte* name);
|
||||
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
|
||||
# else
|
||||
# if defined(__sgi) || defined(__sun)
|
||||
extern void* dlGetProcAddress (const GLubyte* name);
|
||||
# define glewGetProcAddress(name) dlGetProcAddress(name)
|
||||
# else /* __linux */
|
||||
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||
* These functions implement the string processing functionality required in the library.
|
||||
*/
|
||||
extern GLuint _glewStrLen (const GLubyte* s);
|
||||
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
|
||||
extern GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n);
|
||||
extern GLboolean _glewStrSame2 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
|
||||
extern GLboolean _glewStrSame3 (const GLubyte* a, GLuint na, const GLubyte* b, GLuint nb);
|
||||
#endif /* __glew_utils_h__ */
|
Loading…
Reference in New Issue
Block a user