Hello Christoph,
On 07/03/2012 04:00 AM, "Christoph Fünfzig" wrote:
thanks a lot, I have it working now.
Actually, read back has been the problem.
In "OSGRenderBuffer.cpp", it uses "pImg->getPixelFormat()" as the format,
(which should be GL_DEPTH_COMPONENT for the depth buffer)
[SNIP]
Can you please consider adding a format GL_DEPTH_COMPONENT to "OSGImage.cpp" ?
"OSGImage.cpp", line 110:
{ GL_DEPTH_COMPONENT, 1 },
With this addition, it works with RenderBuffer and TextureBuffer as well.
I think the attached patch should do it.
Gerrit: could you eyeball it, I'll probably forever be confused by
OpenGL's format, internal format and data type specifications for
textures/buffers ;)
Cheers,
Carsten
diff --git a/Source/System/Image/OSGImage.cpp b/Source/System/Image/OSGImage.cpp
index 961ca03..2f55100 100644
--- a/Source/System/Image/OSGImage.cpp
+++ b/Source/System/Image/OSGImage.cpp
@@ -99,6 +99,7 @@ UInt32 Image::_formatDic[][2] =
{ OSG_RGBA_DXT1, 4 },
{ OSG_RGBA_DXT3, 4 },
{ OSG_RGBA_DXT5, 4 },
+ { OSG_DEPTH_PF, 1 },
{ OSG_DEPTH_STENCIL_PF, 1 },
{ OSG_ALPHA_INTEGER_PF, 1 },
{ OSG_RGB_INTEGER_PF, 3 },
@@ -234,6 +235,9 @@ void Image::dump( UInt32 ,
case OSG_RGBA_DXT5:
pfStr = "RGBA_DXT5";
break;
+ case OSG_DEPTH_PF:
+ pfStr = "DEPTH";
+ break;
case OSG_DEPTH_STENCIL_PF:
pfStr = "DEPTH_STENCIL";
break;
@@ -2190,13 +2194,17 @@ bool Image::reformat(const Image::PixelFormat pixelFormat,
break;
}
- case OSG_ALPHA_INTEGER_PF:
- case OSG_RGB_INTEGER_PF:
- case OSG_RGBA_INTEGER_PF:
- case OSG_BGR_INTEGER_PF:
- case OSG_BGRA_INTEGER_PF:
- case OSG_LUMINANCE_INTEGER_PF:
- case OSG_LUMINANCE_ALPHA_INTEGER_PF:
+ case OSG_DEPTH_PF:
+#if defined(GL_DEPTH_STENCIL_EXT) || defined(GL_DEPTH_STENCIL_NV)
+ case OSG_DEPTH_STENCIL_PF:
+#endif
+ case OSG_ALPHA_INTEGER_PF:
+ case OSG_RGB_INTEGER_PF:
+ case OSG_RGBA_INTEGER_PF:
+ case OSG_BGR_INTEGER_PF:
+ case OSG_BGRA_INTEGER_PF:
+ case OSG_LUMINANCE_INTEGER_PF:
+ case OSG_LUMINANCE_ALPHA_INTEGER_PF:
{
FFATAL((" 'reformat' NYI\n "));
}
diff --git a/Source/System/Image/OSGImage.h b/Source/System/Image/OSGImage.h
index bef3e6a..7987842 100644
--- a/Source/System/Image/OSGImage.h
+++ b/Source/System/Image/OSGImage.h
@@ -83,7 +83,7 @@ class OSG_SYSTEM_DLLMAPPING Image : public ImageBase
#else
OSG_BGR_PF = 0,
#endif
-
+
/*** BGRA ***/
#if defined(GL_BGRA)
OSG_BGRA_PF = GL_BGRA,
@@ -120,6 +120,8 @@ class OSG_SYSTEM_DLLMAPPING Image : public ImageBase
OSG_RGBA_DXT5 = 0,
#endif
+ OSG_DEPTH_PF = GL_DEPTH_COMPONENT,
+
/*** GL_EXT_packed_depth_stencil ***/
#if defined(GL_DEPTH_STENCIL_EXT)
OSG_DEPTH_STENCIL_PF = GL_DEPTH_STENCIL_EXT,
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users