diff -ru OpenCSG-1.3.0/src/frameBufferObject.cpp OpenCSG-1.3.0-fbofix/src/frameBufferObject.cpp
--- OpenCSG-1.3.0/src/frameBufferObject.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-fbofix/src/frameBufferObject.cpp	2011-08-02 01:33:31.000000000 +0200
@@ -57,6 +57,7 @@
             glGenRenderbuffers(1, &depthID); 
             glGenTextures(1, &textureID);
 
+            glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFramebufferID);
             glBindFramebuffer(GL_FRAMEBUFFER, framebufferID);
             glBindTexture(GL_TEXTURE_2D, textureID);
             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_INT, 0);
@@ -76,7 +77,7 @@
                 return false;
             }
 
-            glBindFramebuffer(GL_FRAMEBUFFER, 0);
+            glBindFramebuffer(GL_FRAMEBUFFER, oldFramebufferID);
             glBindTexture(GL_TEXTURE_2D, 0);
 
             textureTarget = GL_TEXTURE_2D;
@@ -133,7 +134,7 @@
         // Unbinds frame buffer texture.
         bool FrameBufferObject::EndCapture()
         {
-            glBindFramebuffer(GL_FRAMEBUFFER, 0);
+            glBindFramebuffer(GL_FRAMEBUFFER, oldFramebufferID);
             return true;
         }
 
diff -ru OpenCSG-1.3.0/src/frameBufferObject.h OpenCSG-1.3.0-fbofix/src/frameBufferObject.h
--- OpenCSG-1.3.0/src/frameBufferObject.h	2011-08-02 17:30:01.000000000 +0200
+++ OpenCSG-1.3.0-fbofix/src/frameBufferObject.h	2011-08-02 01:32:58.000000000 +0200
@@ -83,6 +83,7 @@
             unsigned int depthID;
 
             unsigned int framebufferID;
+            int oldFramebufferID;
 
             bool         initialized;
         };
diff -ru OpenCSG-1.3.0/src/frameBufferObjectExt.cpp OpenCSG-1.3.0-fbofix/src/frameBufferObjectExt.cpp
--- OpenCSG-1.3.0/src/frameBufferObjectExt.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-fbofix/src/frameBufferObjectExt.cpp	2011-08-02 01:33:46.000000000 +0200
@@ -58,6 +58,7 @@
             glGenRenderbuffersEXT(1, &depthID); 
             glGenTextures(1, &textureID);
 
+            glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &oldFramebufferID);
             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebufferID);	
             glBindTexture(GL_TEXTURE_2D, textureID);
             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_INT, 0);
@@ -77,7 +78,7 @@
                 return false;
             }
 
-            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFramebufferID);
             glBindTexture(GL_TEXTURE_2D, 0);
 
             textureTarget = GL_TEXTURE_2D;
@@ -134,7 +135,7 @@
         // Unbinds frame buffer texture.
         bool FrameBufferObjectExt::EndCapture()
         {
-            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFramebufferID);
             return true;
         }
 
diff -ru OpenCSG-1.3.0/src/frameBufferObjectExt.h OpenCSG-1.3.0-fbofix/src/frameBufferObjectExt.h
--- OpenCSG-1.3.0/src/frameBufferObjectExt.h	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-fbofix/src/frameBufferObjectExt.h	2011-08-02 01:33:08.000000000 +0200
@@ -83,6 +83,7 @@
             unsigned int depthID;
 
             unsigned int framebufferID;
+            int oldFramebufferID;
 
             bool         initialized;
         };
