Hello Constantin,

On 08/26/10 10:07, Carsten Neumann wrote:
On 08/26/10 04:10, Constantin Müller wrote:
Unfortunately this did not help.

I read the specification on this site
(http://www.opengl.org/sdk/docs/man/xhtml/glReadBuffer.xml).
There the Parameter 'mode' has to specify a COLOR-buffer, but the
depth/stencil-buffer isn't a colorbuffer or am I missing something?
Maybe the problem is there?

yes, that seems to be the cause of the first GL_INVALID_ENUM error, but
I can not find any information on what value to specify to read the
depth/stencil buffer - what is the correct value to pass to
glReadBuffer? (I've asked this on the OpenGL forums, perhaps someone
over there can shed some light on this).

hm, apparently one does not pass anything to glReadBuffer (i.e. I suppose GL_NONE is the right value) - I have to admit that this makes little sense to me and I don't understand how the following glReadPixels() is supposed to know that it should read from the combined depth/stencil buffer (thread: <http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=282275#Post282275>).

Based on that feedback I've attached a modified patch that passes GL_NONE to glReadBuffer - it should at least avoid the GL_INVALID_ENUM error and hopefully does read back the right values.

        Cheers,
                Carsten
diff --git a/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp 
b/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp
index af4cf4e..ac777f9 100644
--- a/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp
+++ b/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp
@@ -107,6 +107,9 @@ OSG_USING_NAMESPACE
 UInt32 FrameBufferObject::_uiFramebuffer_object_extension = 
     Window::invalidExtensionID;
 
+UInt32 FrameBufferObject::_uiPackedDepthStencilExtension  =
+    Window::invalidExtensionID;
+
 UInt32 FrameBufferObject::_uiFuncGenFramebuffers          = 
     Window::invalidFunctionID;
 
@@ -179,6 +182,8 @@ void FrameBufferObject::initMethod(InitPhase ePhase)
     {
         _uiFramebuffer_object_extension = 
             Window::registerExtension("GL_EXT_framebuffer_object");
+        _uiPackedDepthStencilExtension  =
+            Window::registerExtension("GL_EXT_packed_depth_stencil");
 
         _uiFuncGenFramebuffers =
             Window::registerFunction (
@@ -403,6 +408,33 @@ void FrameBufferObject::deactivate (DrawEnv *pEnv)
         
             (*attIt)->processPreDeactivate(pEnv, index);
         }
+
+        if(_sfDepthAttachment  .getValue() != NULL &&
+           _sfStencilAttachment.getValue() != NULL   )
+        {
+            if(_sfDepthAttachment.getValue() == 
_sfStencilAttachment.getValue())
+            {
+                _sfDepthAttachment.getValue()->processPreDeactivate(
+                    pEnv, GL_NONE);
+            }
+            else
+            {
+                _sfDepthAttachment  .getValue()->processPreDeactivate(
+                    pEnv, GL_NONE);
+                _sfStencilAttachment.getValue()->processPreDeactivate(
+                    pEnv, GL_NONE);
+            }
+        }
+        else if(_sfDepthAttachment.getValue() != NULL)
+        {
+            _sfDepthAttachment  .getValue()->processPreDeactivate(
+                pEnv, GL_NONE);
+        }
+        else if(_sfStencilAttachment.getValue() != NULL)
+        {
+            _sfStencilAttachment.getValue()->processPreDeactivate(
+                pEnv, GL_NONE);
+        }
     }
 
     osgGlBindFramebufferProc(GL_FRAMEBUFFER_EXT, 0);
diff --git a/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.h 
b/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.h
index 2ebedaf..8437854 100644
--- a/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.h
+++ b/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.h
@@ -133,6 +133,7 @@ class OSG_SYSTEM_DLLMAPPING FrameBufferObject :
     /*! \{                                                                 */
 
     static UInt32 _uiFramebuffer_object_extension;
+    static UInt32 _uiPackedDepthStencilExtension;
 
     static UInt32 _uiFuncGenFramebuffers;
     static UInt32 _uiFuncCheckFramebufferStatus;
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to