Hello Constantin,
On 08/24/10 04:10, Constantin Müller wrote:
The depth/stencil-Image has no pixel data after the rendering.
The colorimage works fine.
Here is my code for the FBO setup:
[SNIP - code]
>
Do I miss something there?
I thought everything is similar to the colorimage, so it has to work
out, but depthimage->isValid() returns false.
hm, it appears readback was only implemented for color attachments :(
The attached patch should change it to also handle depth and stencil
attachments (including combined ones). Can you give it a try and see if
it works for you, thanks!
Cheers,
Carsten
diff --git a/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp
b/Source/System/Window/FrameBufferObjects/OSGFrameBufferObject.cpp
index af4cf4e..138e792 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_DEPTH_STENCIL_EXT);
+ }
+ else
+ {
+ _sfDepthAttachment .getValue()->processPreDeactivate(
+ pEnv, GL_DEPTH_ATTACHMENT_EXT);
+ _sfStencilAttachment.getValue()->processPreDeactivate(
+ pEnv, GL_STENCIL_ATTACHMENT_EXT);
+ }
+ }
+ else if(_sfDepthAttachment.getValue() != NULL)
+ {
+ _sfDepthAttachment .getValue()->processPreDeactivate(
+ pEnv, GL_DEPTH_ATTACHMENT_EXT);
+ }
+ else if(_sfStencilAttachment.getValue() != NULL)
+ {
+ _sfStencilAttachment.getValue()->processPreDeactivate(
+ pEnv, GL_STENCIL_ATTACHMENT_EXT);
+ }
}
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;
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users