From 0ea72a471259a4d16b0a31cfb1781da934afc636 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 19 Dec 2010 07:03:49 +0000 Subject: [PATCH] Remove GLU dependency from Panda3D. Yes. That's right, folks. And now I shall make myself some coffee and wake up, in that order. --- dtool/Config.pp | 10 +--------- dtool/LocalSetup.pp | 15 ++++++++++----- dtool/Package.pp | 2 -- dtool/pptempl/Global.pp | 9 +-------- makepanda/makepanda.py | 15 +++++++-------- panda/metalibs/pandagl/Sources.pp | 2 +- panda/metalibs/pandagl/pandagl.cxx | 2 +- panda/src/gles2gsg/gles2gsg.h | 1 - panda/src/glesgsg/glesgsg.h | 1 - panda/src/glgsg/glgsg.h | 7 ------- panda/src/glstuff/Sources.pp | 2 +- .../src/glstuff/glGraphicsStateGuardian_src.cxx | 17 ++++++----------- panda/src/glstuff/glstuff_src.h | 5 ++--- panda/src/mesadisplay/mesagsg.h | 3 --- panda/src/osxdisplay/osxGraphicsBuffer.h | 1 - .../src/osxdisplay/osxGraphicsStateGuardian.cxx | 1 - panda/src/osxdisplay/osxGraphicsStateGuardian.h | 1 - panda/src/osxdisplay/osxGraphicsWindow.h | 1 - panda/src/pandabase/pandasymbols.h | 11 ----------- 19 files changed, 30 insertions(+), 76 deletions(-) diff --git a/dtool/Config.pp b/dtool/Config.pp index f29810383e..8c351e1e69 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -596,28 +596,20 @@ #define ZLIB_LIBS z #defer HAVE_ZLIB $[libtest $[ZLIB_LPATH],$[ZLIB_LIBS]] -// Is OpenGL installed, and where? This should include libGL as well -// as libGLU, if they are in different places. +// Is OpenGL installed, and where? #defer GL_IPATH /usr/include #defer GL_LPATH #defer GL_LIBS -#defer GLU_LIBS #if $[WINDOWS_PLATFORM] #define GL_LIBS opengl32.lib - #define GLU_LIBS glu32.lib #elif $[OSX_PLATFORM] #defer GL_FRAMEWORK OpenGL #else #defer GL_LPATH /usr/X11R6/lib #defer GL_LIBS GL - #defer GLU_LIBS GLU #endif #defer HAVE_GL $[libtest $[GL_LPATH],$[GL_LIBS]] -// GLU is an auxiliary library that is usually provided with OpenGL, -// but is sometimes missing (e.g. the default FC5 installation). -#defer HAVE_GLU $[libtest $[GL_LPATH],$[GLU_LIBS]] - // If you are having trouble linking in OpenGL extension functions at // runtime for some reason, you can set this variable. This defines // the minimum runtime version of OpenGL that Panda will require. diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index c5177ccaa3..90e068488a 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -123,13 +123,19 @@ #endif #if $[HAVE_GL] #print + OpenGL -#elif $[HAVE_GLES2] -#print + OpenGL ES 2 -#elif $[HAVE_GLES] -#print + OpenGL ES #else #print - Did not find OpenGL #endif +#if $[HAVE_GLES] +#print + OpenGL ES 1 +#else +#print - Did not find OpenGL ES 1 +#endif +#if $[HAVE_GLES2] +#print + OpenGL ES 2 +#else +#print - Did not find OpenGL ES 2 +#endif #if $[HAVE_DX8] #print + DirectX8 #else @@ -341,7 +347,6 @@ $[cdefine HAVE_ZLIB] /* Define if we have OpenGL installed and want to build for GL. */ $[cdefine HAVE_GL] -$[cdefine HAVE_GLU] #if HAVE_GL # define MIN_GL_VERSION_MAJOR $[word 1,$[MIN_GL_VERSION]] # define MIN_GL_VERSION_MINOR $[word 2,$[MIN_GL_VERSION]] diff --git a/dtool/Package.pp b/dtool/Package.pp index 115e5cc57b..dc97beedd6 100644 --- a/dtool/Package.pp +++ b/dtool/Package.pp @@ -221,9 +221,7 @@ #set GL_IPATH $[unixfilename $[GL_IPATH]] #set GL_LPATH $[unixfilename $[GL_LPATH]] #set GL_LIBS $[GL_LIBS] -#set GLU_LIBS $[GLU_LIBS] #set HAVE_GL $[HAVE_GL] -#set HAVE_GLU $[HAVE_GLU] #set GLES_IPATH $[unixfilename $[GLES_IPATH]] #set GLES_LPATH $[unixfilename $[GLES_LPATH]] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index b55ce8f5b5..84626682fb 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -123,7 +123,7 @@ #define gl_ipath $[wildcard $[GL_IPATH]] #define gl_lpath $[wildcard $[GL_LPATH]] #define gl_cflags $[GL_CFLAGS] - #define gl_libs $[GL_LIBS] $[if $[HAVE_GLU],$[GLU_LIBS]] + #define gl_libs $[GL_LIBS] #define gl_framework $[GL_FRAMEWORK] #endif @@ -199,13 +199,6 @@ #define egl_libs $[EGL_LIBS] #endif -#if $[HAVE_GLUT] - #define glut_ipath $[wildcard $[GLUT_IPATH]] - #define glut_lpath $[wildcard $[GLUT_LPATH]] - #define glut_cflags $[GLUT_CFLAGS] - #define glut_libs $[GLUT_LIBS] -#endif - #if $[HAVE_DX8] #define dx8_ipath $[wildcard $[DX8_IPATH]] #define dx8_lpath $[wildcard $[DX8_LPATH]] diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 48ce77ab6f..0bc789762f 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -406,7 +406,6 @@ if (COMPILER=="MSVC"): LibName("WINGDI", "gdi32.lib") LibName("ADVAPI", "advapi32.lib") LibName("GL", "opengl32.lib") - LibName("GL", "glu32.lib") LibName("GLES", "libgles_cm.lib") LibName("GLES2", "libGLESv2.lib") LibName("EGL", "libEGL.lib") @@ -536,7 +535,7 @@ if (COMPILER=="LINUX"): SmartPkgEnable("FFTW", "", ("fftw", "rfftw"), ("fftw.h", "rfftw.h")) SmartPkgEnable("FMODEX", "", ("fmodex"), ("fmodex", "fmodex/fmod.h")) SmartPkgEnable("FREETYPE", "freetype2", ("freetype"), ("freetype2", "freetype2/freetype/freetype.h")) - SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h", "GL/glu.h"), framework = "OpenGL") + SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h"), framework = "OpenGL") SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES") SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) #framework = "OpenGLES"? SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h")) @@ -3284,9 +3283,9 @@ if (not RUNTIME): # if (not sys.platform.startswith("win") and PkgSkip("GL")==0 and PkgSkip("OSMESA")==0 and not RUNTIME): - OPTS=['DIR:panda/src/mesadisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'GL', 'OSMESA'] + OPTS=['DIR:panda/src/mesadisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAMESA', 'NVIDIACG', 'GL', 'OSMESA'] TargetAdd('mesadisplay_composite.obj', opts=OPTS, input='mesadisplay_composite.cxx') - OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'GL'] + OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAMESA', 'NVIDIACG', 'GL'] TargetAdd('libpandamesa.dll', input='mesadisplay_composite.obj') TargetAdd('libpandamesa.dll', input='libp3glstuff.dll') TargetAdd('libpandamesa.dll', input='libpandafx.dll') @@ -3306,9 +3305,9 @@ if (sys.platform != "win32" and sys.platform != "darwin" and PkgSkip("X11")==0 a # if (sys.platform != "win32" and sys.platform != "darwin" and PkgSkip("GL")==0 and PkgSkip("X11")==0 and not RUNTIME): - OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL'] + OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] TargetAdd('glxdisplay_composite.obj', opts=OPTS, input='glxdisplay_composite.cxx') - OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL'] + OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx') TargetAdd('libpandagl.dll', input='x11display_composite.obj') TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj') @@ -3324,10 +3323,10 @@ if (sys.platform != "win32" and sys.platform != "darwin" and PkgSkip("GL")==0 an # if (sys.platform == 'darwin' and PkgSkip("GL")==0 and not RUNTIME): - OPTS=['DIR:panda/src/osxdisplay', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL'] + OPTS=['DIR:panda/src/osxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] TargetAdd('osxdisplay_composite1.obj', opts=OPTS, input='osxdisplay_composite1.cxx') TargetAdd('osxdisplay_osxGraphicsWindow.obj', opts=OPTS, input='osxGraphicsWindow.mm') - OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL'] + OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx') TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj') TargetAdd('libpandagl.dll', input='glgsg_config_glgsg.obj') diff --git a/panda/metalibs/pandagl/Sources.pp b/panda/metalibs/pandagl/Sources.pp index db002a9992..f662d1bd15 100644 --- a/panda/metalibs/pandagl/Sources.pp +++ b/panda/metalibs/pandagl/Sources.pp @@ -20,5 +20,5 @@ #define TARGET pandagl #define SOURCES pandagl.cxx pandagl.h #define INSTALL_HEADERS pandagl.h - #define WIN_SYS_LIBS opengl32.lib glu32.lib winmm.lib kernel32.lib oldnames.lib user32.lib gdi32.lib + #define WIN_SYS_LIBS opengl32.lib winmm.lib kernel32.lib oldnames.lib user32.lib gdi32.lib #end metalib_target diff --git a/panda/metalibs/pandagl/pandagl.cxx b/panda/metalibs/pandagl/pandagl.cxx index 4e3e3f2c5a..7303abe4b0 100644 --- a/panda/metalibs/pandagl/pandagl.cxx +++ b/panda/metalibs/pandagl/pandagl.cxx @@ -1,6 +1,6 @@ // Filename: pandagl.cxx // Created by: drose (15May00) -// +// //////////////////////////////////////////////////////////////////// #include "pandagl.h" diff --git a/panda/src/gles2gsg/gles2gsg.h b/panda/src/gles2gsg/gles2gsg.h index 8ec153d822..32e00cec58 100644 --- a/panda/src/gles2gsg/gles2gsg.h +++ b/panda/src/gles2gsg/gles2gsg.h @@ -22,7 +22,6 @@ #include "config_gles2gsg.h" #define GLP(name) gl##name -#define GLUP(name) glu##name #define CLP(name) GLES2##name #define GLPREFIX_QUOTED "gl" #define CLASSPREFIX_QUOTED "GLES2" diff --git a/panda/src/glesgsg/glesgsg.h b/panda/src/glesgsg/glesgsg.h index fad32f6ab6..f86e94287e 100644 --- a/panda/src/glesgsg/glesgsg.h +++ b/panda/src/glesgsg/glesgsg.h @@ -22,7 +22,6 @@ #include "config_glesgsg.h" #define GLP(name) gl##name -#define GLUP(name) glu##name #define CLP(name) GLES##name #define GLPREFIX_QUOTED "gl" #define CLASSPREFIX_QUOTED "GLES" diff --git a/panda/src/glgsg/glgsg.h b/panda/src/glgsg/glgsg.h index 554a9ada48..f8d3f49d44 100644 --- a/panda/src/glgsg/glgsg.h +++ b/panda/src/glgsg/glgsg.h @@ -23,7 +23,6 @@ #include "config_glgsg.h" #define GLP(name) gl##name -#define GLUP(name) glu##name #define CLP(name) GL##name #define GLPREFIX_QUOTED "gl" #define CLASSPREFIX_QUOTED "GL" @@ -70,14 +69,8 @@ #ifdef IS_OSX #include - #ifdef HAVE_GLU - #include - #endif #else #include - #ifdef HAVE_GLU - #include - #endif #endif #undef GL_GLEXT_VERSION diff --git a/panda/src/glstuff/Sources.pp b/panda/src/glstuff/Sources.pp index 67c5365c55..397ab0f2ea 100644 --- a/panda/src/glstuff/Sources.pp +++ b/panda/src/glstuff/Sources.pp @@ -1,6 +1,6 @@ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ dtoolutil:c dtoolbase:c dtool:m prc:c -#define USE_PACKAGES gl cggl + // Most of the files here are not actually compiled into anything; // they're just included by various other directories. diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index eaf749bd32..cac8903e7b 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -64,7 +64,7 @@ #include "graphicsEngine.h" #include "shaderGenerator.h" -#ifdef HAVE_CG +#if defined(HAVE_CG) && !defined(OPENGLES) #include "Cg/cgGL.h" #endif @@ -838,7 +838,7 @@ reset() { } } -#ifdef HAVE_CG +#if defined(HAVE_CG) && !defined(OPENGLES) if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) && cgGLIsProfileSupported(CG_PROFILE_ARBVP1)) { _supports_basic_shaders = true; @@ -1618,7 +1618,7 @@ reset() { void gl_set_stencil_functions (StencilRenderStates *stencil_render_states); gl_set_stencil_functions (_stencil_render_states); -#ifdef HAVE_CG +#if defined(HAVE_CG) && !defined(OPENGLES) typedef struct { @@ -5173,13 +5173,8 @@ report_errors_loop(int line, const char *source_file, GLenum error_code, //////////////////////////////////////////////////////////////////// string CLP(GraphicsStateGuardian):: get_error_string(GLenum error_code) { -#if defined(HAVE_GLU) && !defined(OPENGLES) - const GLubyte *error_string = GLUP(ErrorString)(error_code); - if (error_string != (const GLubyte *)NULL) { - return string((const char *)error_string); - } -#endif // HAVE_GLU - + // We used to use gluErrorString here, but I (rdb) took it out + // because that was really the only function we used from GLU. // The idea with the error table was taken from SGI's sample implementation. static const char *error_strings[GL_OUT_OF_MEMORY - GL_INVALID_ENUM + 1] = { "invalid enumerant", @@ -9635,7 +9630,7 @@ do_point_size() { //////////////////////////////////////////////////////////////////// bool CLP(GraphicsStateGuardian):: get_supports_cg_profile(const string &name) const { -#ifndef HAVE_CG +#if !defined(HAVE_CG) || defined(OPENGLES) return false; #else CGprofile profile = cgGetProfile(name.c_str()); diff --git a/panda/src/glstuff/glstuff_src.h b/panda/src/glstuff/glstuff_src.h index 40a6bd7cf8..f62c4f8c59 100644 --- a/panda/src/glstuff/glstuff_src.h +++ b/panda/src/glstuff/glstuff_src.h @@ -19,15 +19,14 @@ // file. // #define GLP(name): returns name prefixed by the gl prefix, e.g. gl##name -// #define GLUP(name): returns name prefixed by the glu prefix, e.g. glu##name // #define CLP(name): returns name prefixed by the class prefix, e.g. GL##name // #define CLASSPREFIX_QUOTED: the quoted prefix of CLP, e.g. "GL" // #define CONFIGOBJ: a Configrc object, e.g. config_glgsg // #define GLCAT: a Notify category, e.g. glgsg_cat // #define EXPCL_GL, EXPTP_GL: according to the DLL currently being compiled. -// Also, be sure you include the appropriate gl.h and glu.h header -// files to get all the standard GL symbols declared. GL extensions +// Also, be sure you include the appropriate gl.h header +// file to get all the standard GL symbols declared. GL extensions // are included here via glext.h. // This file is not protected from multiple inclusion; it may need to diff --git a/panda/src/mesadisplay/mesagsg.h b/panda/src/mesadisplay/mesagsg.h index 036dce6b1f..e6c4d0ffb6 100644 --- a/panda/src/mesadisplay/mesagsg.h +++ b/panda/src/mesadisplay/mesagsg.h @@ -28,12 +28,10 @@ #ifdef MESA_MGL #define GLP(name) mgl##name - #define GLUP(name) mglu##name #define GLPREFIX_QUOTED "mgl" #define USE_MGL_NAMESPACE 1 #else #define GLP(name) gl##name - #define GLUP(name) glu##name #define GLPREFIX_QUOTED "gl" #endif #define CLP(name) Mesa##name @@ -74,7 +72,6 @@ #define GL_GLEXT_VERSION 0 #include -#include #include #undef GL_GLEXT_VERSION diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.h b/panda/src/osxdisplay/osxGraphicsBuffer.h index afdd8378c9..a3c30b26c3 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.h +++ b/panda/src/osxdisplay/osxGraphicsBuffer.h @@ -15,7 +15,6 @@ #define __glext_h_ #include -#include #include #include "pandabase.h" diff --git a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx index 9a0381d3bc..54e2acaaca 100644 --- a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx +++ b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx @@ -19,7 +19,6 @@ #include "pnmImage.h" #include -#include #import // This is generated data for the standard texture we use for drawing diff --git a/panda/src/osxdisplay/osxGraphicsStateGuardian.h b/panda/src/osxdisplay/osxGraphicsStateGuardian.h index c70b2bcf98..f8fb9ad60b 100644 --- a/panda/src/osxdisplay/osxGraphicsStateGuardian.h +++ b/panda/src/osxdisplay/osxGraphicsStateGuardian.h @@ -16,7 +16,6 @@ #define __glext_h_ #include -#include #include #include "pandabase.h" diff --git a/panda/src/osxdisplay/osxGraphicsWindow.h b/panda/src/osxdisplay/osxGraphicsWindow.h index 8e98c65cef..a6d66031ca 100644 --- a/panda/src/osxdisplay/osxGraphicsWindow.h +++ b/panda/src/osxdisplay/osxGraphicsWindow.h @@ -20,7 +20,6 @@ #define __glext_h_ #include -#include #include #define HACK_SCREEN_HASH_CONTEXT true diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 0409a1c125..5822b37895 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -152,14 +152,6 @@ #define EXPTP_PANDAGLES2 extern #endif -#ifdef BUILDING_PANDAGLUT - #define EXPCL_PANDAGLUT __declspec(dllexport) - #define EXPTP_PANDAGLUT -#else - #define EXPCL_PANDAGLUT __declspec(dllimport) - #define EXPTP_PANDAGLUT extern -#endif - #ifdef BUILDING_PANDAMESA #define EXPCL_PANDAMESA __declspec(dllexport) #define EXPTP_PANDAMESA @@ -298,9 +290,6 @@ #define EXPCL_PANDAGLES2 #define EXPTP_PANDAGLES2 -#define EXPCL_PANDAGLUT -#define EXPTP_PANDAGLUT - #define EXPCL_PANDAMESA #define EXPTP_PANDAMESA