Hi all,
patch contains extension to fbo and camera. Camera can attach new render
buffer for depth and stencil logical buffer in packed form.
Jaromir
Index: include/osg/Camera
===================================================================
--- include/osg/Camera (revision 9133)
+++ include/osg/Camera (working copy)
@@ -310,6 +310,7 @@
{
DEPTH_BUFFER,
STENCIL_BUFFER,
+ PACKED_DEPTH_STENCIL_BUFFER,
COLOR_BUFFER,
COLOR_BUFFER0,
COLOR_BUFFER1 = COLOR_BUFFER0+1,
Index: include/osg/FrameBufferObject
===================================================================
--- include/osg/FrameBufferObject (revision 9133)
+++ include/osg/FrameBufferObject (working copy)
@@ -114,6 +114,14 @@
#define GL_DEPTH_COMPONENT32 0x81A7
#endif
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_EXT_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_EXT 0x84F9
+#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
+#define GL_DEPTH24_STENCIL8_EXT 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
+#endif
+
namespace osg
{
@@ -165,11 +173,13 @@
bool isSupported() const { return _supported; }
bool isMultisampleSupported() const { return
glRenderbufferStorageMultisampleEXT != 0; }
bool isMultisampleCoverageSupported() const { return
glRenderbufferStorageMultisampleCoverageNV != 0; }
+ bool isPackedDepthStencilSupported() const { return
_packed_depth_stencil_supported; }
protected:
FBOExtensions(unsigned int contextID);
bool _supported;
+ bool _packed_depth_stencil_supported;
};
/**************************************************************************
Index: src/osg/FrameBufferObject.cpp
===================================================================
--- src/osg/FrameBufferObject.cpp (revision 9133)
+++ src/osg/FrameBufferObject.cpp (working copy)
@@ -58,7 +58,8 @@
glFramebufferRenderbufferEXT(0),
glGenerateMipmapEXT(0),
glBlitFramebufferEXT(0),
- _supported(false)
+ _supported(false),
+ _packed_depth_stencil_supported(false)
{
if (!isGLExtensionSupported(contextID, "GL_EXT_framebuffer_object"))
return;
@@ -107,6 +108,11 @@
{
LOAD_FBO_EXT(glRenderbufferStorageMultisampleCoverageNV);
}
+
+ if (isGLExtensionSupported(contextID, "GL_EXT_packed_depth_stencil"))
+ {
+ _packed_depth_stencil_supported = true;
+ }
}
@@ -811,7 +817,26 @@
for (AttachmentMap::const_iterator i=_attachments.begin();
i!=_attachments.end(); ++i)
{
const FrameBufferAttachment &fa = i->second;
- fa.attach(state, target, convertBufferComponentToGLenum(i->first),
ext);
+ switch(i->first)
+ {
+ case(Camera::PACKED_DEPTH_STENCIL_BUFFER):
+ if (ext->isPackedDepthStencilSupported())
+ {
+ fa.attach(state, target, GL_DEPTH_ATTACHMENT_EXT, ext);
+ fa.attach(state, target, GL_STENCIL_ATTACHMENT_EXT,
ext);
+ }
+ else
+ {
+ notify(WARN) <<
+ "Warning: FrameBufferObject: could not attach
PACKED_DEPTH_STENCIL_BUFFER, "
+ "EXT_packed_depth_stencil is not supported !" <<
std::endl;
+ }
+ break;
+
+ default:
+ fa.attach(state, target,
convertBufferComponentToGLenum(i->first), ext);
+ break;
+ }
}
dirtyAttachmentList = 0;
}
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org