Commit 661431ee authored by ikits's avatar ikits
Browse files

Single file now compiles with VC71. Kept multi-file split for future use.


git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@331 783a27ee-832a-0410-bc00-9f386506c6dd
parent 254737d1
......@@ -41,15 +41,33 @@ 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_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
I.TARGETS = \
$(I.DEST)/glew.h \
$(I.DEST)/wglew.h \
$(I.DEST)/glxew.h
all custom: $(TARGETS)
S.TARGETS = \
$(S.DEST)/glew.c \
$(S.DEST)/glewinfo.c
# $(S.DEST)/glew_def.c \
# $(S.DEST)/glew_init.c \
# $(S.DEST)/glew_str.c \
D.TARGETS = \
$(D.DEST)/glew.html \
$(D.DEST)/wglew.html \
$(D.DEST)/glxew.html
all custom: $(I.TARGETS) $(S.TARGETS) $(D.TARGETS)
registry: $(REGISTRY)/.dummy
ext: $(EXT)/.dummy
$(REGISTRY)/.dummy: $(BIN)/update_registry.sh
@echo "--------------------------------------------------------------------"
@echo "Downloading registry"
@echo "--------------------------------------------------------------------"
$(BIN)/update_registry.sh $(REGISTRY) $(REGISTRY_URL)
head -6 $(REGISTRY)/ATI/texture_env_combine3.txt > tmp
tail +7 $(REGISTRY)/ATI/texture_env_combine3.txt | \
......@@ -58,6 +76,9 @@ $(REGISTRY)/.dummy: $(BIN)/update_registry.sh
touch $@
$(EXT)/.dummy: $(REGISTRY)/.dummy
@echo "--------------------------------------------------------------------"
@echo "Creating descriptors"
@echo "--------------------------------------------------------------------"
rm -rf $(EXT)
$(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST)
ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin)
......@@ -70,8 +91,13 @@ endif
touch $@
$(I.DEST)/glew.h: $(EXT)/.dummy
@echo "--------------------------------------------------------------------"
@echo "Creating glew.h"
@echo "--------------------------------------------------------------------"
test -d $(I.DEST) || mkdir -p $(I.DEST)
cp -f $(SRC)/glew_head.h $@
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/sgi_license.h >> $@
cat $(SRC)/glew_head.h >> $@
$(BIN)/make_header.pl GLAPIENTRY GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_header.pl GLAPIENTRY GL $(GL_EXT_SPEC) >> $@
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" >> $@
......@@ -86,7 +112,11 @@ $(I.DEST)/glew.h: $(EXT)/.dummy
cat $(SRC)/glew_tail.h >> $@
$(I.DEST)/wglew.h: $(EXT)/.dummy
cp -f $(SRC)/wglew_head.h $@
@echo "--------------------------------------------------------------------"
@echo "Creating wglew.h"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/wglew_head.h >> $@
$(BIN)/make_header.pl WINAPI WGL $(WGL_EXT_SPEC) >> $@
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 $(WGL_EXT_SPEC) >> $@
......@@ -95,7 +125,12 @@ $(I.DEST)/wglew.h: $(EXT)/.dummy
cat $(SRC)/wglew_tail.h >> $@
$(I.DEST)/glxew.h: $(EXT)/.dummy
cp -f $(SRC)/glxew_head.h $@
@echo "--------------------------------------------------------------------"
@echo "Creating glxew.h"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/glx_license.h >> $@
cat $(SRC)/glxew_head.h >> $@
$(BIN)/make_header.pl '' GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_header.pl '' GLX $(GLX_EXT_SPEC) >> $@
echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_EXPORT\n#else\n#define GLXEW_EXPORT extern\n#endif /* GLEW_MX */" >> $@
......@@ -107,54 +142,121 @@ $(I.DEST)/glxew.h: $(EXT)/.dummy
cat $(SRC)/glxew_tail.h >> $@
$(BIN)/fix_OML_sync_control.sh $@
$(S.DEST)/glew_gl.c: $(EXT)/.dummy
cp -f $(SRC)/glew_gl_head.c $@
$(S.DEST)/glew.c: $(EXT)/.dummy
@echo "--------------------------------------------------------------------"
@echo "Creating glew.c"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/glew_head.c >> $@
echo -e "\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_gl_fun.c >> $@
echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@;
echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@
$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_gl_var.c >> $@
echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
$(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_gl_init.c >> $@
cat $(SRC)/glew_init_gl.c >> $@
$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_gl_tail.c >> $@
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 $@
echo -e "\n return GLEW_OK;\n}\n" >> $@
echo -e "\n#if defined(_WIN32)" >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_wgl_var.c >> $@
echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_wgl_init.c >> $@
cat $(SRC)/glew_init_wgl.c >> $@
$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_wgl_tail.c >> $@
echo -e "\n return GLEW_OK;\n}" >> $@;
echo -e "\n#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)" >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@;
echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
echo -e "GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;" >> $@
$(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@
echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
$(BIN)/make_init.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_init.pl GLX $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_init_glx.c >> $@
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}" >> $@
echo -e "\n#endif /* !__APPLE__ || GLEW_APPLE_GLX */\n" >> $@;
cat $(SRC)/glew_init_tail.c >> $@
cat $(SRC)/glew_str_head.c >> $@
$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_str_wgl.c >> $@
$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_str_glx.c >> $@
$(BIN)/make_str.pl $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_str_tail.c >> $@
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 $@
$(BIN)/fix_OML_sync_control.sh $@
rm -f $@.bak
$(S.DEST)/glew_glx.c: $(EXT)/.dummy
cp -f $(SRC)/glew_glx_head.c $@
$(S.DEST)/glew_def.c: $(EXT)/.dummy
cp -f $(SRC)/glew_license.h $@
echo -e "#include \"glew_utils.h\"\n\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@
echo -e "\n#if !defined(GLEW_MX)\n\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@
$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
echo -e "\n#if defined(_WIN32)" >> $@
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
echo -e "\n#endif /* _WIN32 */" >> $@
echo -e "\n#endif /* !GLEW_MX */" >> $@;
echo -e "\n#if !defined(_WIN32) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_glx_fun.c >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@;
echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
echo -e "GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;" >> $@
$(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_glx_var.c >> $@
echo -e "\n#endif /* !GLEW_MX */" >> $@;
echo -e "\n#endif /* !__APPLE__ || GLEW_APPLE_GLX */" >> $@;
rm -f $@.bak
$(S.DEST)/glew_init.c: $(EXT)/.dummy
cp -f $(SRC)/glew_license.h $@
echo -e "#include \"glew_utils.h\"\n" >> $@
$(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@
$(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_init_gl.c >> $@
$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}\n\n#if defined(_WIN32)\n" >> $@;
$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_init_wgl.c >> $@
$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}\n\n" >> $@;
echo -e "\n#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)\n" >> $@
$(BIN)/make_init.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_init.pl GLX $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_glx_init.c >> $@
cat $(SRC)/glew_init_glx.c >> $@
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_glx_tail.c >> $@
echo -e "\n return GLEW_OK;\n}\n\n#endif /* !__APPLE__ || GLEW_APPLE_GLX */\n" >> $@;
cat $(SRC)/glew_init_tail.c >> $@
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 $@
$(BIN)/fix_OML_sync_control.sh $@
rm -f $@.bak
$(S.DEST)/glew_str.c: $(EXT)/.dummy
cp -f $(SRC)/glew_str_head.c $@
cp -f $(SRC)/glew_license.h $@
echo -e "\n#include \"glew_utils.h\"\n" >> $@
cat $(SRC)/glew_str_head.c >> $@
$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_str_wgl.c >> $@
$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
......@@ -166,9 +268,12 @@ $(S.DEST)/glew_str.c: $(EXT)/.dummy
# 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_head.c $@
@echo "--------------------------------------------------------------------"
@echo "Creating glewinfo.c"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/glewinfo_head.c >> $@
$(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@
$(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@
echo -e "#ifdef _WIN32\n" >> $@
......@@ -190,23 +295,37 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy
$(BIN)/fix_OML_sync_control.sh $@
$(D.DEST)/glew.html: $(EXT)/.dummy
cp -f $(SRC)/glew_head.html $@
@echo "--------------------------------------------------------------------"
@echo "Creating glew.html"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/template.html $@
echo -e "<h2>Supported OpenGL Extensions</h2>\n" >> $@
$(BIN)/make_html.pl $(GL_EXT_SPEC) >> $@
cat $(SRC)/glew_tail.html >> $@
echo -e "</td>\n</tr>\n</table>\n</body>" >> $@
$(D.DEST)/wglew.html: $(EXT)/.dummy
cp -f $(SRC)/wglew_head.html $@
@echo "--------------------------------------------------------------------"
@echo "Creating wglew.html"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/template.html $@
echo -e "<h2>Supported WGL Extensions</h2>\n" >> $@
$(BIN)/make_html.pl $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_tail.html >> $@
echo -e "</td>\n</tr>\n</table>\n</body>" >> $@
$(D.DEST)/glxew.html: $(EXT)/.dummy
cp -f $(SRC)/glxew_head.html $@
@echo "--------------------------------------------------------------------"
@echo "Creating glxew.html"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/template.html $@
echo -e "<h2>Supported GLX Extensions</h2>\n" >> $@
$(BIN)/make_html.pl $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_tail.html >> $@
echo -e "</td>\n</tr>\n</table>\n</body>" >> $@
clean:
rm -rf $(TARGETS)
rm -rf $(EXT)
rm -rf $(I.TARGETS) $(S.TARGETS) $(D.TARGETS)
clobber: clean
rm -rf $(EXT)
destroy: clobber
rm -rf $(REGISTRY)
......@@ -49,10 +49,7 @@ our $type = shift;
if (@ARGV)
{
@extlist = @ARGV;
my $extstr = $extlist[0];
printf STDERR "FASZI: $extstr \n";
#if (length($extstr) > 1)
{
foreach my $ext (sort @extlist)
{
my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext);
......@@ -72,10 +69,3 @@ printf STDERR "FASZI: $extstr \n";
print "\n#endif /* $extname */\n\n";
}
}
}
#} else {
# local $/;
# @extlist = split "\n", (<>);
#}
......@@ -35,16 +35,19 @@ if (@ARGV)
$extname =~ s/^(?:W?)GL(?:X?)_(.*)$/$1/;
if ($cur_group ne $group)
{
if ($group ne "")
{
print "<br>\n";
}
$group = $cur_group;
print "<br>\n";
}
if ($exturl)
{
print "<a href=\"$exturl\">$extname</a><br>\n";
print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"$exturl\">$extname</a><br>\n";
}
else
{
print "$extname<br>\n";
print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$extname<br>\n";
}
}
}
#endif /* !WIN32 || !GLEW_MX */
#if !defined(GLEW_MX)
GLboolean __GLEW_VERSION_1_1 = GL_FALSE;
/*
** 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)
#endif /* !GLEW_MX */
/* ------------------------------------------------------------------------- */
#if !defined(GLEW_MX)
GLboolean __GLXEW_VERSION_1_0 = GL_FALSE;
GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;
/*
** 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(__APPLE__) || defined(GLEW_APPLE_GLX)
return GLEW_OK;
}
#endif /* !__APPLE__ || GLEW_APPLE_GLX */
#endif /* !GLEW_MX */
/* ------------------------------------------------------------------------- */
#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 */
#if defined(__APPLE__)
#include <mach-o/dyld.h>
#include <stdlib.h>
#include <string.h>
void* NSGLGetProcAddress (const GLubyte *name)
{
NSSymbol symbol;
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[0] = '_';
symbol = NULL;
if (NSIsSymbolNameDefined(symbolName))
symbol = NSLookupAndBindSymbol(symbolName);
free(symbolName);
return symbol ? NSAddressOfSymbol(symbol) : NULL;
}
#endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun)
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
void* dlGetProcAddress (const GLubyte* name)
{
static void* h = NULL;
static void* gpa;
if (h == NULL)
{
if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
gpa = dlsym(h, "glXGetProcAddress");
}
if (gpa != NULL)
return ((void*(*)(const GLubyte*))gpa)(name);
else
return dlsym(h, (const char*)name);
}
#endif /* __sgi || __sun */
/*
* Define glewGetProcAddress.
*/
#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
/*
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
* These functions implement the functionality required in this file.
*/
GLuint _glewStrLen (const GLubyte* s)
{
GLuint i=0;
while (s+i != NULL && s[i] != '\0') i++;
return i;
}
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;
}
/*
** 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)