diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/CGAL-OGL-Tess-Combine-Fix.patch | 43 | ||||
-rw-r--r-- | patches/CGAL-Valgrind-Enable-Hack.patch | 16 | ||||
-rw-r--r-- | patches/OpenCSG-1.1.0-Reset-Hack.patch | 82 | ||||
-rw-r--r-- | patches/OpenCSG-1.1.1-MacOSX-port.patch | 276 | ||||
-rw-r--r-- | patches/OpenCSG-1.2.0-MacOSX-port.patch | 285 | ||||
-rw-r--r-- | patches/OpenCSG-1.2.0-Reset-Hack.patch | 89 |
6 files changed, 791 insertions, 0 deletions
diff --git a/patches/CGAL-OGL-Tess-Combine-Fix.patch b/patches/CGAL-OGL-Tess-Combine-Fix.patch new file mode 100644 index 0000000..2a4ad1a --- /dev/null +++ b/patches/CGAL-OGL-Tess-Combine-Fix.patch @@ -0,0 +1,43 @@ +--- CGAL-3.4/include/CGAL/Nef_3/OGL_helper.h ++++ CGAL-3.4/include/CGAL/Nef_3/OGL_helper.h +@@ -243,6 +243,23 @@ + glVertex3dv(pc); + } + ++ inline void CGAL_GLU_TESS_CALLBACK combineCallback(GLdouble coords[3], GLvoid *d[4], GLfloat w[4], GLvoid **dataOut) ++ { ++ static std::list<GLdouble*> pcache; ++ if (dataOut) { ++ GLdouble *n = new GLdouble[3]; ++ n[0] = coords[0]; ++ n[1] = coords[1]; ++ n[2] = coords[2]; ++ pcache.push_back(n); ++ *dataOut = n; ++ } else { ++ for (std::list<GLdouble*>::const_iterator i = pcache.begin(); i != pcache.end(); i++) ++ delete[] *i; ++ pcache.clear(); ++ } ++ } ++ + + enum { SNC_AXES}; + enum { SNC_BOUNDARY, SNC_SKELETON }; +@@ -376,6 +393,8 @@ + GLUtesselator* tess_ = gluNewTess(); + gluTessCallback(tess_, GLenum(GLU_TESS_VERTEX_DATA), + (GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &vertexCallback); ++ gluTessCallback(tess_, GLenum(GLU_TESS_COMBINE), ++ (GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &combineCallback); + gluTessCallback(tess_, GLenum(GLU_TESS_BEGIN), + (GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &beginCallback); + gluTessCallback(tess_, GLenum(GLU_TESS_END), +@@ -410,6 +429,7 @@ + gluTessEndPolygon(tess_); + // CGAL_NEF_TRACEN("End Polygon"); + gluDeleteTess(tess_); ++ combineCallback(NULL, NULL, NULL, NULL); + } + + void construct_axes() const diff --git a/patches/CGAL-Valgrind-Enable-Hack.patch b/patches/CGAL-Valgrind-Enable-Hack.patch new file mode 100644 index 0000000..90733fc --- /dev/null +++ b/patches/CGAL-Valgrind-Enable-Hack.patch @@ -0,0 +1,16 @@ +--- CGAL-3.4/include/CGAL/Interval_nt.h ++++ CGAL-3.4/include/CGAL/Interval_nt.h +@@ -149,11 +149,13 @@ + // The macros CGAL_IA_MUL and CGAL_IA_DIV stop constant propagation only + // on the second argument, so if -fno-rounding-math, the compiler optimizes + // the 2 negations and we get wrong rounding. ++#if 0 + typename Interval_nt<>::Internal_protector P; + CGAL_assertion_msg(-CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1), + "Wrong rounding: did you forget the -frounding-math option if you use GCC?"); + CGAL_assertion_msg(-CGAL_IA_DIV(-1, 10) != CGAL_IA_DIV(1, 10), + "Wrong rounding: did you forget the -frounding-math option if you use GCC?"); ++#endif + } + }; + diff --git a/patches/OpenCSG-1.1.0-Reset-Hack.patch b/patches/OpenCSG-1.1.0-Reset-Hack.patch new file mode 100644 index 0000000..493a11b --- /dev/null +++ b/patches/OpenCSG-1.1.0-Reset-Hack.patch @@ -0,0 +1,82 @@ +diff --git a/include/opencsg.h b/include/opencsg.h +index daecacc..ffde239 100644 +--- a/include/opencsg.h ++++ b/include/opencsg.h +@@ -188,6 +188,9 @@ namespace OpenCSG { + Algorithm = AlgorithmUnused, + DepthComplexityAlgorithm = NoDepthComplexitySampling); + ++ // call this function whenever switching the OpenGL context ++ void reset(); ++ + } // namespace OpenCSG + + #endif // __OpenCSG__opencsg_h__ +diff --git a/src/channelManager.h b/src/channelManager.h +index ecd5a1d..0e1458a 100644 +--- a/src/channelManager.h ++++ b/src/channelManager.h +@@ -79,9 +79,9 @@ namespace OpenCSG { + /// moved into alpha, to allow alpha testing of the channel. + static void setupTexEnv(Channel channel); + +- private: +- + static OpenGL::OffscreenBuffer* gOffscreenBuffer; ++ ++ private: + static int gOffscreenType; + static bool gInUse; + +diff --git a/src/offscreenBuffer.cpp b/src/offscreenBuffer.cpp +index e02dd83..4f978d5 100644 +--- a/src/offscreenBuffer.cpp ++++ b/src/offscreenBuffer.cpp +@@ -22,19 +22,41 @@ + #include "offscreenBuffer.h" + #include "frameBufferObject.h" + #include "pBufferTexture.h" ++#include "channelManager.h" ++ ++static bool reset_f = false; ++static bool reset_p = false; + + namespace OpenCSG { + ++ void reset() ++ { ++ reset_f = true; ++ reset_p = true; ++ OpenCSG::ChannelManager::gOffscreenBuffer = NULL; ++ } ++ + namespace OpenGL { + + OffscreenBuffer* getOffscreenBuffer(bool fbo) { +- static FrameBufferObject* f = new FrameBufferObject; +- static PBufferTexture* p = new PBufferTexture; +- +- if (fbo) +- return f; +- else ++ static FrameBufferObject* f = NULL; ++ static PBufferTexture* p = NULL; ++ ++ if (fbo) { ++ if (reset_f || f == NULL) { ++ delete f; ++ f = new FrameBufferObject; ++ reset_f = false; ++ } ++ return f; ++ } else { ++ if (reset_p || p == NULL) { ++ delete p; ++ p = new PBufferTexture; ++ reset_p = false; ++ } + return p; ++ } + } + + } // namespace OpenGL diff --git a/patches/OpenCSG-1.1.1-MacOSX-port.patch b/patches/OpenCSG-1.1.1-MacOSX-port.patch new file mode 100644 index 0000000..592cdf9 --- /dev/null +++ b/patches/OpenCSG-1.1.1-MacOSX-port.patch @@ -0,0 +1,276 @@ +diff -ru OpenCSG-1.1.1/RenderTexture/RenderTexture.h OpenCSG-1.1.1-mac/RenderTexture/RenderTexture.h +--- OpenCSG-1.1.1/RenderTexture/RenderTexture.h 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/RenderTexture/RenderTexture.h 2009-12-09 03:15:26.000000000 +0100 +@@ -294,8 +294,8 @@ + bool _BindDepthBuffer( ) const; + + protected: // data +- int _iWidth; // width of the pbuffer +- int _iHeight; // height of the pbuffer ++ GLint _iWidth; // width of the pbuffer ++ GLint _iHeight; // height of the pbuffer + + bool _bIsTexture; + bool _bIsDepthTexture; +@@ -342,8 +342,8 @@ + + // Texture stuff + GLenum _iTextureTarget; +- unsigned int _iTextureID; +- unsigned int _iDepthTextureID; ++ GLuint _iTextureID; ++ GLuint _iDepthTextureID; + + unsigned short* _pPoorDepthTexture; // [Redge] + +diff -ru OpenCSG-1.1.1/example/example.pro OpenCSG-1.1.1-mac/example/example.pro +--- OpenCSG-1.1.1/example/example.pro 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/example/example.pro 2009-12-09 03:15:26.000000000 +0100 +@@ -2,9 +2,16 @@ + TARGET = opencsgexample + + CONFIG += opengl warn_on release +-INCLUDEPATH += ../glew/include ../include +- +-LIBS += -L../lib -lopencsg -lglut -L../glew/lib -lGLEW ++INCLUDEPATH += ../include ++LIBS += -L../lib -lopencsg -lGLEW ++macx { ++ INCLUDEPATH += /opt/local/include ++ LIBS += -framework GLUT -L/opt/local/lib ++} ++else { ++ INCLUDEPATH += ../glew/include ++ LIBS += -lglut -L../glew/lib ++} + + HEADERS = displaylistPrimitive.h + SOURCES = displaylistPrimitive.cpp main.cpp +diff -ru OpenCSG-1.1.1/example/main.cpp OpenCSG-1.1.1-mac/example/main.cpp +--- OpenCSG-1.1.1/example/main.cpp 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/example/main.cpp 2009-12-09 03:15:26.000000000 +0100 +@@ -22,7 +22,11 @@ + // + + #include <GL/glew.h> ++#ifdef __APPLE__ ++#include <GLUT/glut.h> ++#else + #include <GL/glut.h> ++#endif + #include <opencsg.h> + #include "displaylistPrimitive.h" + #include <iostream> +diff -ru OpenCSG-1.1.1/opencsg.pro OpenCSG-1.1.1-mac/opencsg.pro +--- OpenCSG-1.1.1/opencsg.pro 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/opencsg.pro 2009-12-09 03:15:26.000000000 +0100 +@@ -1,2 +1,4 @@ + TEMPLATE = subdirs + SUBDIRS = src example ++# On Mac we get glew from MacPorts ++!macx:SUBDIRS += glew +diff -ru OpenCSG-1.1.1/src/channelManager.cpp OpenCSG-1.1.1-mac/src/channelManager.cpp +--- OpenCSG-1.1.1/src/channelManager.cpp 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/channelManager.cpp 2009-12-09 03:15:26.000000000 +0100 +@@ -23,7 +23,7 @@ + #include <GL/glew.h> + #ifdef _WIN32 + #include <GL/wglew.h> +-#else ++#elif !defined(__APPLE__) + #include <GL/glxew.h> + #endif + +@@ -160,9 +160,11 @@ + #ifdef WIN32 + if ( WGLEW_ARB_pbuffer + && WGLEW_ARB_pixel_format +-#else ++#elif !defined(__APPLE__) + if ( GLXEW_SGIX_pbuffer + && GLXEW_SGIX_fbconfig ++#else ++ if ( false + #endif + ) { + newOffscreenType = OpenCSG::PBuffer; +diff -ru OpenCSG-1.1.1/src/frameBufferObject.h OpenCSG-1.1.1-mac/src/frameBufferObject.h +--- OpenCSG-1.1.1/src/frameBufferObject.h 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/frameBufferObject.h 2009-12-09 03:15:26.000000000 +0100 +@@ -77,10 +77,10 @@ + + /// Texture stuff + GLenum textureTarget; +- unsigned int textureID; +- unsigned int depthID; ++ GLuint textureID; ++ GLuint depthID; + +- unsigned int framebufferID; ++ GLuint framebufferID; + + bool initialized; + }; +diff -ru OpenCSG-1.1.1/src/occlusionQuery.cpp OpenCSG-1.1.1-mac/src/occlusionQuery.cpp +--- OpenCSG-1.1.1/src/occlusionQuery.cpp 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/occlusionQuery.cpp 2009-12-09 03:15:26.000000000 +0100 +@@ -57,7 +57,7 @@ + } + + unsigned int OcclusionQueryARB::getQueryResult() { +- unsigned int fragmentCount; ++ GLuint fragmentCount; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &fragmentCount); + return fragmentCount; + } +@@ -94,7 +94,7 @@ + } + + unsigned int OcclusionQueryNV::getQueryResult() { +- unsigned int fragmentCount; ++ GLuint fragmentCount; + glGetOcclusionQueryuivNV(mQueryObject, GL_PIXEL_COUNT_NV, &fragmentCount); + return fragmentCount; + } +diff -ru OpenCSG-1.1.1/src/openglHelper.cpp OpenCSG-1.1.1-mac/src/openglHelper.cpp +--- OpenCSG-1.1.1/src/openglHelper.cpp 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/openglHelper.cpp 2009-12-09 03:15:26.000000000 +0100 +@@ -29,13 +29,13 @@ + + GLfloat projection[16]; + GLfloat modelview[16]; +- int canvasPos[4]; ++ GLint canvasPos[4]; + +- int stencilBits = 0; ++ GLint stencilBits = 0; + int stencilMax = 0; + int stencilMask = 0; + +- int scissorPos[4]; ++ GLint scissorPos[4]; + + void scissor(const PCArea& area) { + const int dx = area.maxx - area.minx; +diff -ru OpenCSG-1.1.1/src/openglHelper.h OpenCSG-1.1.1-mac/src/openglHelper.h +--- OpenCSG-1.1.1/src/openglHelper.h 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/openglHelper.h 2009-12-09 03:15:26.000000000 +0100 +@@ -36,17 +36,17 @@ + // copy of the projection matrix during CSG computation + extern GLfloat modelview[16]; + // copy of the modelview matrix during CSG computation +- extern int canvasPos[4]; ++ extern GLint canvasPos[4]; + // copy of the viewport size during CSG computation + +- extern int stencilBits; ++ extern GLint stencilBits; + // number of stencil bits in the pbuffer + extern int stencilMax; + // the number where the stencil value would "wrap around" to zero + extern int stencilMask; + // stencilMax - 1 + +- extern int scissorPos[4]; ++ extern GLint scissorPos[4]; + // copy of the scissor settings for CSG computation + + void scissor(const PCArea& area); +diff -ru OpenCSG-1.1.1/src/pBufferTexture.h OpenCSG-1.1.1-mac/src/pBufferTexture.h +--- OpenCSG-1.1.1/src/pBufferTexture.h 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/pBufferTexture.h 2009-12-09 03:15:34.000000000 +0100 +@@ -22,7 +22,7 @@ + + #ifndef __OpenCSG__pbuffer_texture_h__ + #define __OpenCSG__pbuffer_texture_h__ +- ++#ifndef __APPLE__ + #include "opencsgConfig.h" + #include "offscreenBuffer.h" + +@@ -81,5 +81,26 @@ + } // namespace OpenGL + + } // namespace OpenCSG ++#else ++ ++namespace OpenCSG { ++ namespace OpenGL { ++ class PBufferTexture : public OffscreenBuffer { ++ virtual bool Initialize(int , int , bool , bool ) {return false;} ++ virtual bool Reset() {return false;} ++ virtual bool Resize(int, int) {return false;} ++ virtual bool BeginCapture() {return false;} ++ virtual bool EndCapture() {return false;} ++ virtual void Bind() const {} ++ virtual void EnableTextureTarget() const {} ++ virtual void DisableTextureTarget() const {} ++ virtual unsigned int GetTextureTarget() const {return 0;} ++ virtual int GetWidth() const {return 0;} ++ virtual int GetHeight() const {return 0;} ++ virtual bool haveSeparateContext() const {return false;} ++ }; ++ } ++} + ++#endif // __APPLE__ + #endif // __OpenCSG__frame_buffer_object_h__ +Only in OpenCSG-1.1.1-mac/src: pBufferTexture.h~ +diff -ru OpenCSG-1.1.1/src/src.pro OpenCSG-1.1.1-mac/src/src.pro +--- OpenCSG-1.1.1/src/src.pro 2009-07-19 21:05:09.000000000 +0200 ++++ OpenCSG-1.1.1-mac/src/src.pro 2009-12-09 03:15:26.000000000 +0100 +@@ -4,7 +4,15 @@ + DESTDIR = ../lib + + CONFIG += opengl warn_on release +-INCLUDEPATH += ../include ../glew/include ../ ++INCLUDEPATH += ../include ../ ++ ++macx { ++ INCLUDEPATH += /opt/local/include ++ LIBS += -L/opt/local/lib -lglew ++} ++else { ++INCLUDEPATH += ../glew/include ++} + + HEADERS = ../include/opencsg.h \ + opencsgConfig.h \ +@@ -16,12 +24,11 @@ + offscreenBuffer.h \ + opencsgRender.h \ + openglHelper.h \ +- pBufferTexture.h \ + primitiveHelper.h \ + scissorMemo.h \ + settings.h \ +- stencilManager.h \ +- ../RenderTexture/RenderTexture.h ++ stencilManager.h ++ + SOURCES = area.cpp \ + batch.cpp \ + channelManager.cpp \ +@@ -30,12 +37,19 @@ + offscreenBuffer.cpp \ + opencsgRender.cpp \ + openglHelper.cpp \ +- pBufferTexture.cpp \ + primitive.cpp \ + primitiveHelper.cpp \ + renderGoldfeather.cpp \ + renderSCS.cpp \ + scissorMemo.cpp \ + settings.cpp \ +- stencilManager.cpp \ +- ../RenderTexture/RenderTexture.cpp ++ stencilManager.cpp ++ ++!macx { ++ HEADERS += ../RenderTexture/RenderTexture.h \ ++ pBufferTexture.h ++ ++ SOURCES += ../RenderTexture/RenderTexture.cpp \ ++ pBufferTexture.cpp ++} ++ diff --git a/patches/OpenCSG-1.2.0-MacOSX-port.patch b/patches/OpenCSG-1.2.0-MacOSX-port.patch new file mode 100644 index 0000000..3f1bdc4 --- /dev/null +++ b/patches/OpenCSG-1.2.0-MacOSX-port.patch @@ -0,0 +1,285 @@ +diff -ru OpenCSG-1.2.0/RenderTexture/RenderTexture.h OpenCSG-1.2.0-mac/RenderTexture/RenderTexture.h +--- OpenCSG-1.2.0/RenderTexture/RenderTexture.h 2010-01-02 20:56:12.000000000 +0100 ++++ OpenCSG-1.2.0-mac/RenderTexture/RenderTexture.h 2010-01-24 23:30:24.000000000 +0100 +@@ -294,8 +294,8 @@ + bool _BindDepthBuffer( ) const; + + protected: // data +- int _iWidth; // width of the pbuffer +- int _iHeight; // height of the pbuffer ++ GLint _iWidth; // width of the pbuffer ++ GLint _iHeight; // height of the pbuffer + + bool _bIsTexture; + bool _bIsDepthTexture; +@@ -342,8 +342,8 @@ + + // Texture stuff + GLenum _iTextureTarget; +- unsigned int _iTextureID; +- unsigned int _iDepthTextureID; ++ GLuint _iTextureID; ++ GLuint _iDepthTextureID; + + unsigned short* _pPoorDepthTexture; // [Redge] + +diff -ru OpenCSG-1.2.0/example/example.pro OpenCSG-1.2.0-mac/example/example.pro +--- OpenCSG-1.2.0/example/example.pro 2010-01-02 20:56:12.000000000 +0100 ++++ OpenCSG-1.2.0-mac/example/example.pro 2010-01-24 23:30:24.000000000 +0100 +@@ -2,9 +2,16 @@ + TARGET = opencsgexample + + CONFIG += opengl warn_on release +-INCLUDEPATH += ../glew/include ../include +- +-LIBS += -L../lib -lopencsg -lglut -L../glew/lib -lGLEW ++INCLUDEPATH += ../include ++LIBS += -L../lib -lopencsg -lGLEW ++macx { ++ INCLUDEPATH += /opt/local/include ++ LIBS += -framework GLUT -L/opt/local/lib ++} ++else { ++ INCLUDEPATH += ../glew/include ++ LIBS += -lglut -L../glew/lib ++} + + HEADERS = displaylistPrimitive.h + SOURCES = displaylistPrimitive.cpp main.cpp +diff -ru OpenCSG-1.2.0/example/main.cpp OpenCSG-1.2.0-mac/example/main.cpp +--- OpenCSG-1.2.0/example/main.cpp 2010-01-02 21:03:19.000000000 +0100 ++++ OpenCSG-1.2.0-mac/example/main.cpp 2010-01-24 23:30:24.000000000 +0100 +@@ -22,7 +22,11 @@ + // + + #include <GL/glew.h> ++#ifdef __APPLE__ ++#include <GLUT/glut.h> ++#else + #include <GL/glut.h> ++#endif + #include <opencsg.h> + #include "displaylistPrimitive.h" + #include <iostream> +diff -ru OpenCSG-1.2.0/opencsg.pro OpenCSG-1.2.0-mac/opencsg.pro +--- OpenCSG-1.2.0/opencsg.pro 2010-01-02 20:56:12.000000000 +0100 ++++ OpenCSG-1.2.0-mac/opencsg.pro 2010-01-24 23:30:24.000000000 +0100 +@@ -1,2 +1,4 @@ + TEMPLATE = subdirs + SUBDIRS = src example ++# On Mac we get glew from MacPorts ++!macx:SUBDIRS += glew +diff -ru OpenCSG-1.2.0/src/channelManager.cpp OpenCSG-1.2.0-mac/src/channelManager.cpp +--- OpenCSG-1.2.0/src/channelManager.cpp 2010-01-02 21:03:04.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/channelManager.cpp 2010-01-24 23:30:24.000000000 +0100 +@@ -23,7 +23,7 @@ + #include <GL/glew.h> + #ifdef _WIN32 + #include <GL/wglew.h> +-#else ++#elif !defined(__APPLE__) + #include <GL/glxew.h> + #endif + +@@ -170,9 +170,11 @@ + #ifdef WIN32 + if ( WGLEW_ARB_pbuffer + && WGLEW_ARB_pixel_format +-#else ++#elif !defined(__APPLE__) + if ( GLXEW_SGIX_pbuffer + && GLXEW_SGIX_fbconfig ++#else ++ if ( false + #endif + ) { + newOffscreenType = OpenCSG::PBuffer; +Only in OpenCSG-1.2.0-mac/src: channelManager.cpp.orig +diff -ru OpenCSG-1.2.0/src/frameBufferObject.h OpenCSG-1.2.0-mac/src/frameBufferObject.h +--- OpenCSG-1.2.0/src/frameBufferObject.h 2010-01-02 21:03:01.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/frameBufferObject.h 2010-01-24 23:30:24.000000000 +0100 +@@ -77,10 +77,10 @@ + + /// Texture stuff + GLenum textureTarget; +- unsigned int textureID; +- unsigned int depthID; ++ GLuint textureID; ++ GLuint depthID; + +- unsigned int framebufferID; ++ GLuint framebufferID; + + bool initialized; + }; +Only in OpenCSG-1.2.0-mac/src: frameBufferObject.h.orig +diff -ru OpenCSG-1.2.0/src/occlusionQuery.cpp OpenCSG-1.2.0-mac/src/occlusionQuery.cpp +--- OpenCSG-1.2.0/src/occlusionQuery.cpp 2010-01-02 21:03:04.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/occlusionQuery.cpp 2010-01-24 23:30:24.000000000 +0100 +@@ -57,7 +57,7 @@ + } + + unsigned int OcclusionQueryARB::getQueryResult() { +- unsigned int fragmentCount; ++ GLuint fragmentCount; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &fragmentCount); + return fragmentCount; + } +@@ -94,7 +94,7 @@ + } + + unsigned int OcclusionQueryNV::getQueryResult() { +- unsigned int fragmentCount; ++ GLuint fragmentCount; + glGetOcclusionQueryuivNV(mQueryObject, GL_PIXEL_COUNT_NV, &fragmentCount); + return fragmentCount; + } +diff -ru OpenCSG-1.2.0/src/openglHelper.cpp OpenCSG-1.2.0-mac/src/openglHelper.cpp +--- OpenCSG-1.2.0/src/openglHelper.cpp 2010-01-02 21:03:04.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/openglHelper.cpp 2010-01-24 23:30:24.000000000 +0100 +@@ -29,13 +29,13 @@ + + GLfloat projection[16]; + GLfloat modelview[16]; +- int canvasPos[4]; ++ GLint canvasPos[4]; + +- int stencilBits = 0; ++ GLint stencilBits = 0; + int stencilMax = 0; + int stencilMask = 0; + +- int scissorPos[4]; ++ GLint scissorPos[4]; + + void scissor(const PCArea& area) { + const int dx = area.maxx - area.minx; +diff -ru OpenCSG-1.2.0/src/openglHelper.h OpenCSG-1.2.0-mac/src/openglHelper.h +--- OpenCSG-1.2.0/src/openglHelper.h 2010-01-02 21:03:01.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/openglHelper.h 2010-01-24 23:30:24.000000000 +0100 +@@ -36,17 +36,17 @@ + // copy of the projection matrix during CSG computation + extern GLfloat modelview[16]; + // copy of the modelview matrix during CSG computation +- extern int canvasPos[4]; ++ extern GLint canvasPos[4]; + // copy of the viewport size during CSG computation + +- extern int stencilBits; ++ extern GLint stencilBits; + // number of stencil bits in the pbuffer + extern int stencilMax; + // the number where the stencil value would "wrap around" to zero + extern int stencilMask; + // stencilMax - 1 + +- extern int scissorPos[4]; ++ extern GLint scissorPos[4]; + // copy of the scissor settings for CSG computation + + void scissor(const PCArea& area); +diff -ru OpenCSG-1.2.0/src/pBufferTexture.h OpenCSG-1.2.0-mac/src/pBufferTexture.h +--- OpenCSG-1.2.0/src/pBufferTexture.h 2010-01-02 21:03:01.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/pBufferTexture.h 2010-01-24 23:30:24.000000000 +0100 +@@ -22,7 +22,7 @@ + + #ifndef __OpenCSG__pbuffer_texture_h__ + #define __OpenCSG__pbuffer_texture_h__ +- ++#ifndef __APPLE__ + #include "opencsgConfig.h" + #include "offscreenBuffer.h" + +@@ -81,5 +81,26 @@ + } // namespace OpenGL + + } // namespace OpenCSG ++#else ++ ++namespace OpenCSG { ++ namespace OpenGL { ++ class PBufferTexture : public OffscreenBuffer { ++ virtual bool Initialize(int , int , bool , bool ) {return false;} ++ virtual bool Reset() {return false;} ++ virtual bool Resize(int, int) {return false;} ++ virtual bool BeginCapture() {return false;} ++ virtual bool EndCapture() {return false;} ++ virtual void Bind() const {} ++ virtual void EnableTextureTarget() const {} ++ virtual void DisableTextureTarget() const {} ++ virtual unsigned int GetTextureTarget() const {return 0;} ++ virtual int GetWidth() const {return 0;} ++ virtual int GetHeight() const {return 0;} ++ virtual bool haveSeparateContext() const {return false;} ++ }; ++ } ++} + ++#endif // __APPLE__ + #endif // __OpenCSG__frame_buffer_object_h__ +diff -ru OpenCSG-1.2.0/src/src.pro OpenCSG-1.2.0-mac/src/src.pro +--- OpenCSG-1.2.0/src/src.pro 2010-01-02 20:56:12.000000000 +0100 ++++ OpenCSG-1.2.0-mac/src/src.pro 2010-01-24 23:31:57.000000000 +0100 +@@ -1,10 +1,19 @@ + TEMPLATE = lib + TARGET = opencsg + VERSION = 1.2.0 +-DESTDIR = ../lib ++DESTDIR = $$(PWD)/lib + + CONFIG += opengl warn_on release +-INCLUDEPATH += ../include ../glew/include ../ ++INCLUDEPATH += ../include ../ ++ ++macx { ++ INCLUDEPATH += /opt/local/include ++ LIBS += -L/opt/local/lib -lglew ++ CONFIG += absolute_library_soname ++} ++else { ++INCLUDEPATH += ../glew/include ++} + + HEADERS = ../include/opencsg.h \ + opencsgConfig.h \ +@@ -17,12 +26,11 @@ + offscreenBuffer.h \ + opencsgRender.h \ + openglHelper.h \ +- pBufferTexture.h \ + primitiveHelper.h \ + scissorMemo.h \ + settings.h \ +- stencilManager.h \ +- ../RenderTexture/RenderTexture.h ++ stencilManager.h ++ + SOURCES = area.cpp \ + batch.cpp \ + channelManager.cpp \ +@@ -32,12 +40,21 @@ + offscreenBuffer.cpp \ + opencsgRender.cpp \ + openglHelper.cpp \ +- pBufferTexture.cpp \ + primitive.cpp \ + primitiveHelper.cpp \ + renderGoldfeather.cpp \ + renderSCS.cpp \ + scissorMemo.cpp \ + settings.cpp \ +- stencilManager.cpp \ +- ../RenderTexture/RenderTexture.cpp ++ stencilManager.cpp ++ ++!macx { ++ HEADERS += ../RenderTexture/RenderTexture.h \ ++ pBufferTexture.h ++ ++ SOURCES += ../RenderTexture/RenderTexture.cpp \ ++ pBufferTexture.cpp ++} ++ ++INSTALLS += target ++target.path = $$DESTDIR +Only in OpenCSG-1.2.0-mac/src: src.pro.orig diff --git a/patches/OpenCSG-1.2.0-Reset-Hack.patch b/patches/OpenCSG-1.2.0-Reset-Hack.patch new file mode 100644 index 0000000..7254ce7 --- /dev/null +++ b/patches/OpenCSG-1.2.0-Reset-Hack.patch @@ -0,0 +1,89 @@ +diff -ru OpenCSG-1.2.0/include/opencsg.h OpenCSG-1.2.0-reset/include/opencsg.h +--- OpenCSG-1.2.0/include/opencsg.h 2010-01-02 21:04:10.000000000 +0100 ++++ OpenCSG-1.2.0-reset/include/opencsg.h 2010-01-03 00:41:30.000000000 +0100 +@@ -229,6 +229,9 @@ + Algorithm, + DepthComplexityAlgorithm = NoDepthComplexitySampling); + ++ // call this function whenever switching the OpenGL context ++ void reset(); ++ + } // namespace OpenCSG + + #endif // __OpenCSG__opencsg_h__ +Only in OpenCSG-1.2.0-reset/include: opencsg.h~ +diff -ru OpenCSG-1.2.0/src/channelManager.h OpenCSG-1.2.0-reset/src/channelManager.h +--- OpenCSG-1.2.0/src/channelManager.h 2010-01-02 21:03:01.000000000 +0100 ++++ OpenCSG-1.2.0-reset/src/channelManager.h 2010-01-03 00:40:53.000000000 +0100 +@@ -79,9 +79,9 @@ + /// moved into alpha, to allow alpha testing of the channel. + static void setupTexEnv(Channel channel); + +- private: +- + static OpenGL::OffscreenBuffer* gOffscreenBuffer; ++ ++ private: + static int gOffscreenType; + static bool gInUse; + +Only in OpenCSG-1.2.0-reset/src: channelManager.h~ +diff -ru OpenCSG-1.2.0/src/offscreenBuffer.cpp OpenCSG-1.2.0-reset/src/offscreenBuffer.cpp +--- OpenCSG-1.2.0/src/offscreenBuffer.cpp 2010-01-02 21:03:04.000000000 +0100 ++++ OpenCSG-1.2.0-reset/src/offscreenBuffer.cpp 2010-01-03 00:41:28.000000000 +0100 +@@ -24,9 +24,22 @@ + #include "frameBufferObjectExt.h" + #include "pBufferTexture.h" + #include <GL/glew.h> ++#include "channelManager.h" ++ ++static bool reset_fARB = false; ++static bool reset_fEXT = false; ++static bool reset_p = false; + + namespace OpenCSG { + ++ void reset() ++ { ++ reset_fARB = true; ++ reset_fEXT = true; ++ reset_p = true; ++ OpenCSG::ChannelManager::gOffscreenBuffer = NULL; ++ } ++ + namespace OpenGL { + + OffscreenBuffer* getOffscreenBuffer(bool fbo) { +@@ -36,19 +49,28 @@ + + if (fbo) { + if (GLEW_ARB_framebuffer_object) { +- if (!fARB) ++ if (reset_fARB || !fARB) { ++ delete fARB; + fARB = new FrameBufferObject; ++ reset_fARB = false; ++ } + return fARB; + } + else { +- if (!fEXT) ++ if (reset_fEXT || !fEXT) { ++ delete fEXT; + fEXT = new FrameBufferObjectExt; ++ reset_fEXT = false; ++ } + return fEXT; + } + } + else { +- if (!p) ++ if (reset_p || !p) { ++ delete p; + p = new PBufferTexture; ++ reset_p = false; ++ } + return p; + } + } +Only in OpenCSG-1.2.0-reset/src: offscreenBuffer.cpp~ |