From Farshid Lashkari, "I've attached a small patch that extends the Image::readImageFromCurrentTexture method to support more depth texture pixel formats (16, 24, 32, 32F). In order to compile, I moved some depth pixel format definitions from FrameBufferObject to Image.

"
This commit is contained in:
Robert Osfield 2013-06-24 09:51:30 +00:00
parent 3c1a89604b
commit 261db64a9e
3 changed files with 30 additions and 18 deletions

View File

@ -108,24 +108,6 @@
#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
#endif
#ifndef GL_DEPTH_COMPONENT
#define GL_DEPTH_COMPONENT 0x1902
#endif
#ifndef GL_VERSION_1_4
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#endif
#ifndef GL_DEPTH_COMPONENT32F
#define GL_DEPTH_COMPONENT32F 0x8CAC
#endif
#ifndef GL_DEPTH_COMPONENT32F_NV
#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
#endif
#ifndef GL_EXT_packed_depth_stencil
#define GL_EXT_packed_depth_stencil 1
#define GL_DEPTH_STENCIL_EXT 0x84F9

View File

@ -97,6 +97,24 @@
#define GL_ETC1_RGB8_OES 0x8D64
#endif
#ifndef GL_DEPTH_COMPONENT
#define GL_DEPTH_COMPONENT 0x1902
#endif
#ifndef GL_VERSION_1_4
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#endif
#ifndef GL_DEPTH_COMPONENT32F
#define GL_DEPTH_COMPONENT32F 0x8CAC
#endif
#ifndef GL_DEPTH_COMPONENT32F_NV
#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
#endif
namespace osg {
// forward declare

View File

@ -408,6 +408,13 @@ GLenum Image::computePixelFormat(GLenum format)
case(GL_RGBA8UI_EXT):
return GL_RGBA_INTEGER_EXT;
case(GL_DEPTH_COMPONENT16):
case(GL_DEPTH_COMPONENT24):
case(GL_DEPTH_COMPONENT32):
case(GL_DEPTH_COMPONENT32F):
case(GL_DEPTH_COMPONENT32F_NV):
return GL_DEPTH_COMPONENT;
default:
return format;
}
@ -490,6 +497,11 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
case(GL_COLOR_INDEX): return 1;
case(GL_STENCIL_INDEX): return 1;
case(GL_DEPTH_COMPONENT): return 1;
case(GL_DEPTH_COMPONENT16): return 1;
case(GL_DEPTH_COMPONENT24): return 1;
case(GL_DEPTH_COMPONENT32): return 1;
case(GL_DEPTH_COMPONENT32F): return 1;
case(GL_DEPTH_COMPONENT32F_NV): return 1;
case(GL_RED): return 1;
case(GL_GREEN): return 1;
case(GL_BLUE): return 1;