From: Mikko Rasa Date: Thu, 27 Oct 2016 22:02:40 +0000 (+0300) Subject: Pull in sized depth component formats from ARB_depth_texture X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=0221e39a685c4f3122a0fae032a7888b5ce40579;p=libs%2Fgl.git Pull in sized depth component formats from ARB_depth_texture --- diff --git a/extensions/arb_depth_texture.glext b/extensions/arb_depth_texture.glext new file mode 100644 index 00000000..03a9725a --- /dev/null +++ b/extensions/arb_depth_texture.glext @@ -0,0 +1 @@ +extension ARB_depth_texture diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index 679c6467..99f15307 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -96,6 +96,9 @@ PixelFormat get_base_pixelformat(PixelFormat pf) case LUMINANCE_ALPHA32F: case SLUMINANCE_ALPHA: case SLUMINANCE8_ALPHA8: return LUMINANCE_ALPHA; + case DEPTH_COMPONENT16: + case DEPTH_COMPONENT24: + case DEPTH_COMPONENT32: return DEPTH_COMPONENT; default: return pf; } } @@ -147,11 +150,15 @@ unsigned get_component_size(PixelFormat pf) case RGBA16F: case LUMINANCE16F: case LUMINANCE_ALPHA16F: + case DEPTH_COMPONENT16: return 2; + case DEPTH_COMPONENT24: + return 3; case RGB32F: case RGBA32F: case LUMINANCE32F: case LUMINANCE_ALPHA32F: + case DEPTH_COMPONENT32: return 4; default: return 1; @@ -191,6 +198,12 @@ void require_pixelformat(PixelFormat pf) case BGRA: { static Require _req(EXT_bgra); } break; + case DEPTH_COMPONENT: + case DEPTH_COMPONENT16: + case DEPTH_COMPONENT24: + case DEPTH_COMPONENT32: + { static Require _req(ARB_depth_texture); } + break; default: break; } diff --git a/source/pixelformat.h b/source/pixelformat.h index 7a562cc9..8e3e6901 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -4,6 +4,7 @@ #include #include #include "gl.h" +#include #include #include #include @@ -17,6 +18,9 @@ enum PixelFormat { STENCIL_INDEX = GL_STENCIL_INDEX, DEPTH_COMPONENT = GL_DEPTH_COMPONENT, + DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16, + DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24, + DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32, RGB = GL_RGB, RGBA = GL_RGBA, RGB8 = GL_RGB8, diff --git a/source/texture.cpp b/source/texture.cpp index 004d78c2..fd144585 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -78,7 +78,7 @@ Texture::~Texture() DataType Texture::get_alloc_type(PixelFormat fmt) { - return (fmt==DEPTH_COMPONENT ? UNSIGNED_SHORT : UNSIGNED_BYTE); + return (get_base_pixelformat(fmt)==DEPTH_COMPONENT ? UNSIGNED_SHORT : UNSIGNED_BYTE); } void Texture::update_parameter(int mask) const