Browse Source

Support for ARB_texture_stencil8.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
9f61c08e97
  1. 10
      src/AbstractTexture.cpp
  2. 7
      src/ImageFormat.h
  3. 9
      src/TextureFormat.h

10
src/AbstractTexture.cpp

@ -423,6 +423,11 @@ ImageFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
return ImageFormat::DepthComponent; return ImageFormat::DepthComponent;
#ifndef MAGNUM_TARGET_GLES
case TextureFormat::StencilIndex8:
return ImageFormat::StencilIndex;
#endif
case TextureFormat::DepthStencil: case TextureFormat::DepthStencil:
case TextureFormat::Depth24Stencil8: case TextureFormat::Depth24Stencil8:
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -605,6 +610,11 @@ ImageType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
return ImageType::Float; return ImageType::Float;
#endif #endif
#ifndef MAGNUM_TARGET_GLES
case TextureFormat::StencilIndex8:
return ImageType::UnsignedByte;
#endif
case TextureFormat::DepthStencil: case TextureFormat::DepthStencil:
case TextureFormat::Depth24Stencil8: case TextureFormat::Depth24Stencil8:
return ImageType::UnsignedInt248; return ImageType::UnsignedInt248;

7
src/ImageFormat.h

@ -223,8 +223,11 @@ enum class ImageFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES3 #ifndef MAGNUM_TARGET_GLES3
/** /**
* Stencil index. For framebuffer reading only. * Stencil index.
* @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil} * @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? * @todo Where to get GL_STENCIL_INDEX in ES?
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

9
src/TextureFormat.h

@ -809,6 +809,15 @@ enum class TextureFormat: GLenum {
DepthComponent32F = GL_DEPTH_COMPONENT32F, DepthComponent32F = GL_DEPTH_COMPONENT32F,
#endif #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. * Depth and stencil component, size implementation-dependent.
* @deprecated Prefer to use exactly specified version of this format, e.g. * @deprecated Prefer to use exactly specified version of this format, e.g.

Loading…
Cancel
Save