diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index fc02749d7..26835ac0b 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -423,6 +423,11 @@ ImageFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in #endif return ImageFormat::DepthComponent; + #ifndef MAGNUM_TARGET_GLES + case TextureFormat::StencilIndex8: + return ImageFormat::StencilIndex; + #endif + case TextureFormat::DepthStencil: case TextureFormat::Depth24Stencil8: #ifndef MAGNUM_TARGET_GLES2 @@ -605,6 +610,11 @@ ImageType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern return ImageType::Float; #endif + #ifndef MAGNUM_TARGET_GLES + case TextureFormat::StencilIndex8: + return ImageType::UnsignedByte; + #endif + case TextureFormat::DepthStencil: case TextureFormat::Depth24Stencil8: return ImageType::UnsignedInt248; diff --git a/src/ImageFormat.h b/src/ImageFormat.h index 308f1f023..9ab0818a9 100644 --- a/src/ImageFormat.h +++ b/src/ImageFormat.h @@ -223,8 +223,11 @@ enum class ImageFormat: GLenum { #ifndef MAGNUM_TARGET_GLES3 /** - * Stencil index. For framebuffer reading only. - * @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil} + * Stencil index. + * @requires_gl44 %Extension @extension{ARB,texture_stencil8} for texture + * data, otherwise for framebuffer reading only. + * @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil}, + * for framebuffer reading only. * @todo Where to get GL_STENCIL_INDEX in ES? */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/TextureFormat.h b/src/TextureFormat.h index 86d68f36e..5625ffc0d 100644 --- a/src/TextureFormat.h +++ b/src/TextureFormat.h @@ -809,6 +809,15 @@ enum class TextureFormat: GLenum { DepthComponent32F = GL_DEPTH_COMPONENT32F, #endif + #ifndef MAGNUM_TARGET_GLES + /** + * Stencil index, 8bit. + * @requires_gl44 %Extension @extension{ARB,texture_stencil8} + * @requires_gl Only available as renderbuffer format in OpenGL ES. + */ + StencilIndex8 = GL_STENCIL_INDEX8, + #endif + /** * Depth and stencil component, size implementation-dependent. * @deprecated Prefer to use exactly specified version of this format, e.g.