|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Some small patches for minor issuesHi,
Attached are a few small patches on the SCI branch of GLEW which I feel are somewhat trivial. The hope is that they'll be easy to review && can thus be applied quickly. The larger hope is that we get things upstream in bite-size pieces, so that the "dynamically load OpenGL" functionality doesn't feel like a ton of work to review. Overview: 1. Build the binaries from the object files instead of the .c files. 2. glew_utils.c doesn't seem to be used ever. Historical artifact? Remove it. 3. GLU isn't needed to use GLEW. Further, we should not force clients to utilize or even have GLU. Don't include it in our headers, but add the include into visualinfo.c to make sure it still compiles. 4. Windows basically locks every file it opens, making it difficult to edit a file in place. Use a perl option to create backup files, such that we don't need in-place modifications. I've tested && this does *not* leave ".bak" files laying around the tree, at least on Linux w/ perl 5.10. Thanks, -tom From 9b6f5e7ceb2b4ca94cd6a65536cb0ac8552884a8 Mon Sep 17 00:00:00 2001 From: Tom Fogal <tfogal@...> Date: Mon, 12 Jan 2009 18:38:11 -0700 Subject: [PATCH 1/4] Generate binaries from object files. This modifies the targets to build binaries from the object files instead of directly from the source files. --- Makefile | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4c64a31..8d4f12b 100644 --- a/Makefile +++ b/Makefile @@ -69,10 +69,10 @@ LIB.LIBS = $(GL_LDFLAGS) GLEWINFO.BIN = glewinfo$(BIN.SUFFIX) GLEWINFO.BIN.SRCS = src/glewinfo.c -GLEWINFO.BIN.OBJS = $(GLEWINFO_BIN.SRCS:.c=.o) +GLEWINFO.BIN.OBJS = $(GLEWINFO.BIN.SRCS:.c=.o) VISUALINFO.BIN = visualinfo$(BIN.SUFFIX) VISUALINFO.BIN.SRCS = src/visualinfo.c -VISUALINFO.BIN.OBJS = $(VISUALINFO_BIN.SRCS:.c=.o) +VISUALINFO.BIN.OBJS = $(VISUALINFO.BIN.SRCS:.c=.o) BIN.LIBS = -Llib $(LDFLAGS.DYNAMIC) -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL) all debug: lib/$(LIB.SHARED) lib/$(LIB.STATIC) bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) @@ -91,11 +91,11 @@ else $(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK) endif -bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.SRCS) lib/$(LIB.SHARED) - $(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.SRCS) $(BIN.LIBS) +bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJS) lib/$(LIB.SHARED) + $(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJS) $(BIN.LIBS) -bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.SRCS) lib/$(LIB.SHARED) - $(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.SRCS) $(BIN.LIBS) +bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJS) lib/$(LIB.SHARED) + $(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJS) $(BIN.LIBS) %.o: %.c $(CC) -c $(CFLAGS) -o $@ $< -- 1.6.3.3 From 5ef23d2f64db30d03a0c16314072735d5d629ec5 Mon Sep 17 00:00:00 2001 From: Tom Fogal <tfogal@...> Date: Sun, 8 Mar 2009 16:03:22 -0700 Subject: [PATCH 2/4] Remove glew_utils.c. Seems to be subsumed by glew_head.c, and it's confusing to keep it around. --- auto/src/glew_utils.c | 162 ------------------------------------------------- 1 files changed, 0 insertions(+), 162 deletions(-) delete mode 100644 auto/src/glew_utils.c diff --git a/auto/src/glew_utils.c b/auto/src/glew_utils.c deleted file mode 100644 index 85fb57f..0000000 --- a/auto/src/glew_utils.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -** The OpenGL Extension Wrangler Library -** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org> -** Copyright (C) 2002-2008, 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. -*/ - -#include <GL/glew.h> -#if defined(_WIN32) -# include <GL/wglew.h> -#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) -# include <GL/glxew.h> -#endif - -#include "glew_utils.h" - -#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 */ - -/* - * 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 _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) -{ - while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t')) - { - *a++; - *na--; - } - 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 _glewStrSame2 (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 (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 && (*na == nb || *a[i] == ' ' || *a[i] == '\n' || *a[i] == '\r' || *a[i] == '\t')) - { - *a = *a + nb; - *na = *na - nb; - return GL_TRUE; - } - } - return GL_FALSE; -} -- 1.6.3.3 From e58731f3350cdf1d3571455d919ce8bca1006d5b Mon Sep 17 00:00:00 2001 From: Tom Fogal <tfogal@...> Date: Thu, 11 Jun 2009 13:12:58 -0600 Subject: [PATCH 3/4] Don't automatically include GLU. GLU is not needed, and GLEW shouldn't enforce that applications include the GLU headers anyway. Include GLU in visualinfo. Recent interface change: we don't force the user to include GLU. --- auto/src/glew_head.h | 10 ---------- src/visualinfo.c | 5 +++++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/auto/src/glew_head.h b/auto/src/glew_head.h index cffa472..ae5ecfe 100644 --- a/auto/src/glew_head.h +++ b/auto/src/glew_head.h @@ -1053,13 +1053,3 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh #define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1) #endif /* GL_VERSION_1_1 */ - -/* ---------------------------------- GLU ---------------------------------- */ - -/* this is where we can safely include GLU */ -#if defined(__APPLE__) && defined(__MACH__) -#include <OpenGL/glu.h> -#else -#include <GL/glu.h> -#endif - diff --git a/src/visualinfo.c b/src/visualinfo.c index f3ae91f..4c70c88 100644 --- a/src/visualinfo.c +++ b/src/visualinfo.c @@ -40,6 +40,11 @@ #else #include <GL/glxew.h> #endif +#if defined(__APPLE__) +# include <AGL/glu.h> +#else +# include <GL/glu.h> +#endif #ifdef GLEW_MX GLEWContext _glewctx; -- 1.6.3.3 From adc0969ec8e18df44f406ac6c8d3722a085ef9d2 Mon Sep 17 00:00:00 2001 From: Jianrong Shu <jshu@...> Date: Fri, 2 Oct 2009 03:19:03 -0600 Subject: [PATCH 4/4] Fixes for perl scripts on Windows. Changed option '-pi' to '-pi.bak' so perl scripts can run successfully on Windows under Cygwin and MinGW. --- auto/bin/fix_OML_sync_control.sh | 16 ++++++++-------- auto/bin/update_ext.sh | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/auto/bin/fix_OML_sync_control.sh b/auto/bin/fix_OML_sync_control.sh index 2579ab4..7e92c07 100755 --- a/auto/bin/fix_OML_sync_control.sh +++ b/auto/bin/fix_OML_sync_control.sh @@ -7,12 +7,12 @@ ## General Public License Version 2 as published by the Free Software ## Foundation or, at your option, any later version. -perl -e 's/#ifndef GLX_OML_sync_control/#if !defined(GLX_OML_sync_control) \&\& defined(__STDC_VERSION__) \&\& (__STDC_VERSION__ >= 199901L)\n#include <inttypes.h>/;' -pi $1 -perl -e 's/#ifdef GLX_OML_sync_control/#if defined(GLX_OML_sync_control) \&\& defined(__STDC_VERSION__) \&\& (__STDC_VERSION__ >= 199901L)\n#include <inttypes.h>/;' -pi $1 -perl -e 's/(extern PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;)/#ifdef GLX_OML_sync_control\n\1/' -pi $1 -perl -e 's/(extern PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;)/\1\n#endif/' -pi $1 -perl -e 's/(extern GLboolean __GLXEW_OML_sync_control;)/#ifdef GLX_OML_sync_control\n\1\n#endif/' -pi $1 -perl -e 's/(PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL;)/#ifdef GLX_OML_sync_control\n\1/' -pi $1 -perl -e 's/(PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL;)/\1\n#endif/' -pi $1 -perl -e 's/(GLboolean __GLXEW_OML_sync_control = GL_FALSE;)/#ifdef GLX_OML_sync_control\n\1\n#endif/' -pi $1 +perl -e 's/#ifndef GLX_OML_sync_control/#if !defined(GLX_OML_sync_control) \&\& defined(__STDC_VERSION__) \&\& (__STDC_VERSION__ >= 199901L)\n#include <inttypes.h>/;' -pi.bak $1 +perl -e 's/#ifdef GLX_OML_sync_control/#if defined(GLX_OML_sync_control) \&\& defined(__STDC_VERSION__) \&\& (__STDC_VERSION__ >= 199901L)\n#include <inttypes.h>/;' -pi.bak $1 +perl -e 's/(extern PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;)/#ifdef GLX_OML_sync_control\n\1/' -pi.bak $1 +perl -e 's/(extern PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;)/\1\n#endif/' -pi.bak $1 +perl -e 's/(extern GLboolean __GLXEW_OML_sync_control;)/#ifdef GLX_OML_sync_control\n\1\n#endif/' -pi.bak $1 +perl -e 's/(PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL;)/#ifdef GLX_OML_sync_control\n\1/' -pi.bak $1 +perl -e 's/(PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL;)/\1\n#endif/' -pi.bak $1 +perl -e 's/(GLboolean __GLXEW_OML_sync_control = GL_FALSE;)/#ifdef GLX_OML_sync_control\n\1\n#endif/' -pi.bak $1 rm -f $1.bak diff --git a/auto/bin/update_ext.sh b/auto/bin/update_ext.sh index 3e17c82..de020a3 100755 --- a/auto/bin/update_ext.sh +++ b/auto/bin/update_ext.sh @@ -59,13 +59,13 @@ EOT # fix GL_NV_occlusion_query and GL_HP_occlusion_test grep -v '_HP' $1/GL_NV_occlusion_query > tmp mv tmp $1/GL_NV_occlusion_query - perl -e's/OCCLUSION_TEST_HP.*/OCCLUSION_TEST_HP 0x8165/' -pi \ + perl -e's/OCCLUSION_TEST_HP.*/OCCLUSION_TEST_HP 0x8165/' -pi.bak \ $1/GL_HP_occlusion_test - perl -e's/OCCLUSION_TEST_RESULT_HP.*/OCCLUSION_TEST_RESULT_HP 0x8166/' -pi \ + perl -e's/OCCLUSION_TEST_RESULT_HP.*/OCCLUSION_TEST_RESULT_HP 0x8166/' -pi.bak \ $1/GL_HP_occlusion_test # fix GLvoid in GL_ARB_vertex_buffer_objects - perl -e 's/ void\*/ GLvoid\*/g' -pi \ + perl -e 's/ void\*/ GLvoid\*/g' -pi.bak \ $1/GL_ARB_vertex_buffer_object # add deprecated constants to GL_ATI_fragment_shader @@ -162,10 +162,10 @@ EOT rm -f $1/GL_SUN_multi_draw_arrays # change variable names in GL_ARB_vertex_shader - perl -e 's/v0/x/g' -pi $1/GL_ARB_vertex_shader - perl -e 's/v1/y/g' -pi $1/GL_ARB_vertex_shader - perl -e 's/v2/z/g' -pi $1/GL_ARB_vertex_shader - perl -e 's/v3/w/g' -pi $1/GL_ARB_vertex_shader + perl -e 's/v0/x/g' -pi.bak $1/GL_ARB_vertex_shader + perl -e 's/v1/y/g' -pi.bak $1/GL_ARB_vertex_shader + perl -e 's/v2/z/g' -pi.bak $1/GL_ARB_vertex_shader + perl -e 's/v3/w/g' -pi.bak $1/GL_ARB_vertex_shader # remove triplicates in GL_ARB_shader_objects, GL_ARB_fragment_shader, # and GL_ARB_vertex_shader @@ -206,7 +206,7 @@ EOT # fix bugs in GL_ARB_vertex_shader grep -v "GL_FLOAT" $1/GL_ARB_vertex_shader > tmp mv tmp $1/GL_ARB_vertex_shader - perl -e 's/handle /GLhandleARB /g' -pi $1/GL_ARB_vertex_shader + perl -e 's/handle /GLhandleARB /g' -pi.bak $1/GL_ARB_vertex_shader # fix bugs in GL_ARB_shader_objects grep -v "GL_FLOAT " $1/GL_ARB_shader_objects > tmp @@ -235,7 +235,7 @@ EOT EOT # fix const correctness in GL_ARB_shader_objects -# perl -e 's/(.+glUniform.*(fv|iv).+)(GLfloat\*.+|GLint\*.+)/\1const \3/;' -pi $1/GL_ARB_shader_objects +# perl -e 's/(.+glUniform.*(fv|iv).+)(GLfloat\*.+|GLint\*.+)/\1const \3/;' -pi.bak $1/GL_ARB_shader_objects # clean up rm -f $1/*.bak -- 1.6.3.3 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ glew-coders mailing list glew-coders@... https://lists.sourceforge.net/lists/listinfo/glew-coders |
| Free embeddable forum powered by Nabble | Forum Help |