From 8d732c87aacbbd7db7d12d7aae37bad6d5a51405 Mon Sep 17 00:00:00 2001 From: clifford Date: Tue, 5 Jan 2010 21:10:39 +0000 Subject: Clifford Wolf: Some housekeeping git-svn-id: http://svn.clifford.at/openscad/trunk@205 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/OpenCSG-1.1.0-Reset-Hack.patch b/OpenCSG-1.1.0-Reset-Hack.patch new file mode 100644 index 0000000..493a11b --- /dev/null +++ b/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/OpenCSG-Reset-Hack.patch b/OpenCSG-Reset-Hack.patch deleted file mode 100644 index 493a11b..0000000 --- a/OpenCSG-Reset-Hack.patch +++ /dev/null @@ -1,82 +0,0 @@ -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/release-linux.sh b/release-linux.sh old mode 100644 new mode 100755 -- cgit v0.10.1