Browse Source

First-class WebGL support, part 7: reduced color formats.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
90b89c6f3d
  1. 14
      src/Magnum/AbstractImage.cpp
  2. 32
      src/Magnum/AbstractTexture.cpp
  3. 14
      src/Magnum/ColorFormat.cpp
  4. 164
      src/Magnum/ColorFormat.h
  5. 129
      src/Magnum/RenderbufferFormat.h
  6. 21
      src/Magnum/Text/DistanceFieldGlyphCache.cpp
  7. 4
      src/Magnum/Text/GlyphCache.cpp
  8. 242
      src/Magnum/TextureFormat.h
  9. 26
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp
  10. 3
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
  11. 6
      src/MagnumPlugins/TgaImporter/TgaImporter.cpp

14
src/Magnum/AbstractImage.cpp

@ -63,16 +63,22 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) {
case ColorType::UnsignedShort565Rev: case ColorType::UnsignedShort565Rev:
#endif #endif
case ColorType::UnsignedShort4444: case ColorType::UnsignedShort4444:
#ifndef MAGNUM_TARGET_WEBGL
case ColorType::UnsignedShort4444Rev: case ColorType::UnsignedShort4444Rev:
#endif
case ColorType::UnsignedShort5551: case ColorType::UnsignedShort5551:
#ifndef MAGNUM_TARGET_WEBGL
case ColorType::UnsignedShort1555Rev: case ColorType::UnsignedShort1555Rev:
#endif
return 2; return 2;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
case ColorType::UnsignedInt8888: case ColorType::UnsignedInt8888:
case ColorType::UnsignedInt8888Rev: case ColorType::UnsignedInt8888Rev:
case ColorType::UnsignedInt1010102: case ColorType::UnsignedInt1010102:
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case ColorType::UnsignedInt2101010Rev: case ColorType::UnsignedInt2101010Rev:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case ColorType::UnsignedInt10F11F11FRev: case ColorType::UnsignedInt10F11F11FRev:
case ColorType::UnsignedInt5999Rev: case ColorType::UnsignedInt5999Rev:
@ -86,7 +92,9 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) {
} }
switch(format) { switch(format) {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case ColorFormat::Red: case ColorFormat::Red:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case ColorFormat::RedInteger: case ColorFormat::RedInteger:
#endif #endif
@ -100,9 +108,13 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) {
case ColorFormat::Luminance: case ColorFormat::Luminance:
#endif #endif
case ColorFormat::DepthComponent: case ColorFormat::DepthComponent:
#ifndef MAGNUM_TARGET_WEBGL
case ColorFormat::StencilIndex: case ColorFormat::StencilIndex:
#endif
return 1*size; return 1*size;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case ColorFormat::RG: case ColorFormat::RG:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case ColorFormat::RGInteger: case ColorFormat::RGInteger:
#endif #endif
@ -123,7 +135,9 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case ColorFormat::RGBAInteger: case ColorFormat::RGBAInteger:
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
case ColorFormat::BGRA: case ColorFormat::BGRA:
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
case ColorFormat::BGRAInteger: case ColorFormat::BGRAInteger:
#endif #endif

32
src/Magnum/AbstractTexture.cpp

@ -463,6 +463,7 @@ void AbstractTexture::bindInternal() {
ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat internalFormat) { ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat internalFormat) {
switch(internalFormat) { switch(internalFormat) {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::Red: case TextureFormat::Red:
case TextureFormat::R8: case TextureFormat::R8:
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -482,6 +483,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedSignedRedRgtc1: case TextureFormat::CompressedSignedRedRgtc1:
#endif #endif
return ColorFormat::Red; return ColorFormat::Red;
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::R8UI: case TextureFormat::R8UI:
@ -493,6 +495,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
return ColorFormat::RedInteger; return ColorFormat::RedInteger;
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::RG: case TextureFormat::RG:
case TextureFormat::RG8: case TextureFormat::RG8:
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -512,6 +515,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedSignedRGRgtc2: case TextureFormat::CompressedSignedRGRgtc2:
#endif #endif
return ColorFormat::RG; return ColorFormat::RG;
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RG8UI: case TextureFormat::RG8UI:
@ -524,7 +528,9 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
case TextureFormat::RGB: case TextureFormat::RGB:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::RGB8: case TextureFormat::RGB8:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGB8Snorm: case TextureFormat::RGB8Snorm:
#endif #endif
@ -542,7 +548,7 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::RGB5: case TextureFormat::RGB5:
#endif #endif
case TextureFormat::RGB565: case TextureFormat::RGB565:
#ifndef MAGNUM_TARGET_GLES3 #if !defined(MAGNUM_TARGET_GLES3) && !defined(MAGNUM_TARGET_WEBGL)
case TextureFormat::RGB10: case TextureFormat::RGB10:
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -574,7 +580,9 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
case TextureFormat::RGBA: case TextureFormat::RGBA:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::RGBA8: case TextureFormat::RGBA8:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGBA8Snorm: case TextureFormat::RGBA8Snorm:
#endif #endif
@ -591,7 +599,9 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
case TextureFormat::RGBA4: case TextureFormat::RGBA4:
case TextureFormat::RGB5A1: case TextureFormat::RGB5A1:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::RGB10A2: case TextureFormat::RGB10A2:
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
case TextureFormat::RGBA12: case TextureFormat::RGBA12:
#endif #endif
@ -625,9 +635,13 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
case TextureFormat::DepthComponent: case TextureFormat::DepthComponent:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::DepthComponent16: case TextureFormat::DepthComponent16:
case TextureFormat::DepthComponent24: case TextureFormat::DepthComponent24:
#endif
#ifndef MAGNUM_TARGET_WEBGL
case TextureFormat::DepthComponent32: case TextureFormat::DepthComponent32:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::DepthComponent32F: case TextureFormat::DepthComponent32F:
#endif #endif
@ -639,7 +653,9 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
#endif #endif
case TextureFormat::DepthStencil: case TextureFormat::DepthStencil:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::Depth24Stencil8: case TextureFormat::Depth24Stencil8:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::Depth32FStencil8: case TextureFormat::Depth32FStencil8:
#endif #endif
@ -651,14 +667,18 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat internalFormat) { ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat internalFormat) {
switch(internalFormat) { switch(internalFormat) {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::Red: case TextureFormat::Red:
case TextureFormat::RG: case TextureFormat::RG:
#endif
case TextureFormat::RGB: case TextureFormat::RGB:
case TextureFormat::RGBA: case TextureFormat::RGBA:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::R8: case TextureFormat::R8:
case TextureFormat::RG8: case TextureFormat::RG8:
case TextureFormat::RGB8: case TextureFormat::RGB8:
case TextureFormat::RGBA8: case TextureFormat::RGBA8:
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::R8UI: case TextureFormat::R8UI:
case TextureFormat::RG8UI: case TextureFormat::RG8UI:
@ -785,6 +805,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
case TextureFormat::RGB565: case TextureFormat::RGB565:
return ColorType::UnsignedShort565; return ColorType::UnsignedShort565;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
#ifndef MAGNUM_TARGET_GLES3 #ifndef MAGNUM_TARGET_GLES3
case TextureFormat::RGB10: case TextureFormat::RGB10:
#endif #endif
@ -793,6 +814,7 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
case TextureFormat::RGB10A2UI: case TextureFormat::RGB10A2UI:
#endif #endif
return ColorType::UnsignedInt2101010Rev; /**< @todo Rev for all? */ return ColorType::UnsignedInt2101010Rev; /**< @todo Rev for all? */
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
case TextureFormat::R11FG11FB10F: case TextureFormat::R11FG11FB10F:
@ -801,12 +823,18 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
return ColorType::UnsignedInt5999Rev; return ColorType::UnsignedInt5999Rev;
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::DepthComponent16: case TextureFormat::DepthComponent16:
return ColorType::UnsignedShort; return ColorType::UnsignedShort;
#endif
case TextureFormat::DepthComponent: case TextureFormat::DepthComponent:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::DepthComponent24: case TextureFormat::DepthComponent24:
#endif
#ifndef MAGNUM_TARGET_WEBGL
case TextureFormat::DepthComponent32: case TextureFormat::DepthComponent32:
#endif
return ColorType::UnsignedInt; return ColorType::UnsignedInt;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -820,7 +848,9 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
#endif #endif
case TextureFormat::DepthStencil: case TextureFormat::DepthStencil:
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case TextureFormat::Depth24Stencil8: case TextureFormat::Depth24Stencil8:
#endif
return ColorType::UnsignedInt248; return ColorType::UnsignedInt248;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2

14
src/Magnum/ColorFormat.cpp

@ -33,7 +33,9 @@ namespace Magnum {
Debug operator<<(Debug debug, const ColorFormat value) { Debug operator<<(Debug debug, const ColorFormat value) {
switch(value) { switch(value) {
#define _c(value) case ColorFormat::value: return debug << "ColorFormat::" #value; #define _c(value) case ColorFormat::value: return debug << "ColorFormat::" #value;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
_c(Red) _c(Red)
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
_c(Green) _c(Green)
_c(Blue) _c(Blue)
@ -41,7 +43,9 @@ Debug operator<<(Debug debug, const ColorFormat value) {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
_c(Luminance) _c(Luminance)
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
_c(RG) _c(RG)
#endif
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
_c(LuminanceAlpha) _c(LuminanceAlpha)
#endif #endif
@ -50,7 +54,9 @@ Debug operator<<(Debug debug, const ColorFormat value) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
_c(BGR) _c(BGR)
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
_c(BGRA) _c(BGRA)
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
_c(RedInteger) _c(RedInteger)
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -66,7 +72,9 @@ Debug operator<<(Debug debug, const ColorFormat value) {
#endif #endif
#endif #endif
_c(DepthComponent) _c(DepthComponent)
#ifndef MAGNUM_TARGET_WEBGL
_c(StencilIndex) _c(StencilIndex)
#endif
_c(DepthStencil) _c(DepthStencil)
#undef _c #undef _c
} }
@ -100,15 +108,21 @@ Debug operator<<(Debug debug, const ColorType value) {
_c(UnsignedShort565Rev) _c(UnsignedShort565Rev)
#endif #endif
_c(UnsignedShort4444) _c(UnsignedShort4444)
#ifndef MAGNUM_TARGET_WEBGL
_c(UnsignedShort4444Rev) _c(UnsignedShort4444Rev)
#endif
_c(UnsignedShort5551) _c(UnsignedShort5551)
#ifndef MAGNUM_TARGET_WEBGL
_c(UnsignedShort1555Rev) _c(UnsignedShort1555Rev)
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
_c(UnsignedInt8888) _c(UnsignedInt8888)
_c(UnsignedInt8888Rev) _c(UnsignedInt8888Rev)
_c(UnsignedInt1010102) _c(UnsignedInt1010102)
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
_c(UnsignedInt2101010Rev) _c(UnsignedInt2101010Rev)
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
_c(UnsignedInt10F11F11FRev) _c(UnsignedInt10F11F11FRev)
_c(UnsignedInt5999Rev) _c(UnsignedInt5999Rev)

164
src/Magnum/ColorFormat.h

@ -53,28 +53,35 @@ See documentation of these values for possible limitations when using OpenGL ES
@see @ref Image, @ref ImageReference, @ref BufferImage, @ref Trade::ImageData @see @ref Image, @ref ImageReference, @ref BufferImage, @ref Trade::ImageData
*/ */
enum class ColorFormat: GLenum { enum class ColorFormat: GLenum {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Floating-point red channel. * Floating-point red channel.
* @requires_gles30 For texture data only, extension @es_extension{EXT,texture_rg} * @requires_gles30 For texture data only, extension
* in OpenGL ES 2.0 * @es_extension{EXT,texture_rg} in OpenGL ES 2.0.
* @requires_es_extension For framebuffer reading, extension @es_extension{EXT,texture_rg} * @requires_es_extension For framebuffer reading, extension
* @es_extension{EXT,texture_rg}
* @requires_webgl20 For texture data only. Not available in WebGL 1.0, see
* @ref ColorFormat::Luminance for an alternative.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
Red = GL_RED, Red = GL_RED,
#else #else
Red = GL_RED_EXT, Red = GL_RED_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Floating-point green channel. * Floating-point green channel.
* @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES. * @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES or
* WebGL.
*/ */
Green = GL_GREEN, Green = GL_GREEN,
/** /**
* Floating-point blue channel. * Floating-point blue channel.
* @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES. * @requires_gl Only @ref ColorFormat::Red is available in OpenGL ES or
* WebGL.
*/ */
Blue = GL_BLUE, Blue = GL_BLUE,
#endif #endif
@ -83,33 +90,38 @@ enum class ColorFormat: GLenum {
/** /**
* Floating-point luminance channel. The value is used for all RGB * Floating-point luminance channel. The value is used for all RGB
* channels. * channels.
* @requires_gles20 Not available in ES 3.0 or desktop OpenGL. Use * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL.
* @ref ColorFormat::Red instead. * Use @ref ColorFormat::Red instead.
* @deprecated_gl Included for compatibility reasons only, use * @deprecated_gl Included for compatibility reasons only, use
* @ref ColorFormat::Red instead. * @ref ColorFormat::Red instead.
*/ */
Luminance = GL_LUMINANCE, Luminance = GL_LUMINANCE,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Floating-point red and green channel. * Floating-point red and green channel.
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 For texture data only, extension @es_extension{EXT,texture_rg} * @requires_gles30 For texture data only, extension
* in OpenGL ES 2.0 * @es_extension{EXT,texture_rg} in OpenGL ES 2.0.
* @requires_es_extension For framebuffer reading, extension @es_extension{EXT,texture_rg}. * @requires_es_extension For framebuffer reading, extension
* @es_extension{EXT,texture_rg}
* @requires_webgl20 For texture data only. Not available in WebGL 1.0, see
* @ref ColorFormat::LuminanceAlpha for and alternative.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RG = GL_RG, RG = GL_RG,
#else #else
RG = GL_RG_EXT, RG = GL_RG_EXT,
#endif #endif
#endif
#if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT) #if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT)
/** /**
* Floating-point luminance and alpha channel. First value is used for all * Floating-point luminance and alpha channel. First value is used for all
* RGB channels, second value is used for alpha channel. * RGB channels, second value is used for alpha channel.
* @requires_gles20 Not available in ES 3.0 or desktop OpenGL. Use * @requires_gles20 Not available in ES 3.0, WebGL 2.0 or desktop OpenGL.
* @ref ColorFormat::RG instead. * Use @ref ColorFormat::RG instead.
* @deprecated_gl Included for compatibility reasons only, use * @deprecated_gl Included for compatibility reasons only, use
* @ref ColorFormat::RG instead. * @ref ColorFormat::RG instead.
*/ */
@ -118,7 +130,7 @@ enum class ColorFormat: GLenum {
/** /**
* Floating-point RGB. * Floating-point RGB.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL.
*/ */
RGB = GL_RGB, RGB = GL_RGB,
@ -128,22 +140,26 @@ enum class ColorFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Floating-point BGR. * Floating-point BGR.
* @requires_gl Only RGB component ordering is available in OpenGL ES. * @requires_gl Only RGB component ordering is available in OpenGL ES and
* WebGL.
*/ */
BGR = GL_BGR, BGR = GL_BGR,
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* Floating-point BGRA. * Floating-point BGRA.
* @requires_es_extension Extension @es_extension{EXT,read_format_bgra} * @requires_es_extension Extension @es_extension{EXT,read_format_bgra}
* for framebuffer reading, extension @es_extension{APPLE,texture_format_BGRA8888} * for framebuffer reading, extension @es_extension{APPLE,texture_format_BGRA8888}
* or @es_extension{EXT,texture_format_BGRA8888} for texture data. * or @es_extension{EXT,texture_format_BGRA8888} for texture data.
* @requires_gles Only RGBA component ordering is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
BGRA = GL_BGRA, BGRA = GL_BGRA,
#else #else
BGRA = GL_BGRA_EXT, BGRA = GL_BGRA_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -151,6 +167,8 @@ enum class ColorFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only floating-point image data are available in OpenGL * @requires_gles30 Only floating-point image data are available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Only floating-point image data are available in WebGL
* 1.0.
*/ */
RedInteger = GL_RED_INTEGER, RedInteger = GL_RED_INTEGER,
@ -159,7 +177,8 @@ enum class ColorFormat: GLenum {
* Integer green channel. * Integer green channel.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES * @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES
* 3.0, only floating-point image data are available in OpenGL ES 2.0. * 3.0 and WebGL 2.0, only floating-point image data are available in
* OpenGL ES 2.0 and WebGL 1.0.
*/ */
GreenInteger = GL_GREEN_INTEGER, GreenInteger = GL_GREEN_INTEGER,
@ -167,7 +186,8 @@ enum class ColorFormat: GLenum {
* Integer blue channel. * Integer blue channel.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES * @requires_gl Only @ref ColorFormat::RedInteger is available in OpenGL ES
* 3.0, only floating-point image data are available in OpenGL ES 2.0. * 3.0 and WebGL 2.0, only floating-point image data are available in
* OpenGL ES 2.0 and WebGL 1.0.
*/ */
BlueInteger = GL_BLUE_INTEGER, BlueInteger = GL_BLUE_INTEGER,
#endif #endif
@ -175,18 +195,24 @@ enum class ColorFormat: GLenum {
/** /**
* Integer red and green channel. * Integer red and green channel.
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_gles30 For texture data only, only floating-point image data * @requires_gles30 For texture data only, only floating-point image data
* are available in OpenGL ES 2.0. * are available in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, only floating-point image data
* are available in WebGL 1.0.
*/ */
RGInteger = GL_RG_INTEGER, RGInteger = GL_RG_INTEGER,
/** /**
* Integer RGB. * Integer RGB.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_gles30 For texture data only, only floating-point image data * @requires_gles30 For texture data only, only floating-point image data
* are available in OpenGL ES 2.0. * are available in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, only floating-point image data
* are available in WebGL 1.0.
*/ */
RGBInteger = GL_RGB_INTEGER, RGBInteger = GL_RGB_INTEGER,
@ -195,6 +221,8 @@ enum class ColorFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only floating-point image data are available in OpenGL * @requires_gles30 Only floating-point image data are available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Only floating-point image data are available in WebGL
* 1.0.
*/ */
RGBAInteger = GL_RGBA_INTEGER, RGBAInteger = GL_RGBA_INTEGER,
@ -203,7 +231,8 @@ enum class ColorFormat: GLenum {
* Integer BGR. * Integer BGR.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Only @ref ColorFormat::RGBInteger is available in OpenGL ES * @requires_gl Only @ref ColorFormat::RGBInteger is available in OpenGL ES
* 3.0, only floating-point image data are available in OpenGL ES 2.0. * 3.0 and WebGL 2.0, only floating-point image data are available in
* OpenGL ES 2.0 and WebGL 1.0.
*/ */
BGRInteger = GL_BGR_INTEGER, BGRInteger = GL_BGR_INTEGER,
@ -211,8 +240,8 @@ enum class ColorFormat: GLenum {
* Integer BGRA. * Integer BGRA.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Only @ref ColorFormat::RGBAInteger is available in OpenGL * @requires_gl Only @ref ColorFormat::RGBAInteger is available in OpenGL
* ES 3.0, only floating-point image data are available in OpenGL ES * ES 3.0 and WebGL 2.0, only floating-point image data are available
* 2.0. * in OpenGL ES 2.0 and WebGL 1.0.
*/ */
BGRAInteger = GL_BGRA_INTEGER, BGRAInteger = GL_BGRA_INTEGER,
#endif #endif
@ -221,18 +250,22 @@ enum class ColorFormat: GLenum {
/** /**
* Depth component. * Depth component.
* @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture}
* or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0 * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0.
* @requires_es_extension For framebuffer reading only, extension * @requires_es_extension For framebuffer reading only, extension
* @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}. * @es_extension2{NV,read_depth,GL_NV_read_depth_stencil}.
* @requires_webgl20 For texture data only, extension
* @webgl_extension{WEBGL,depth_texture} in WebGL 1.0.
*/ */
DepthComponent = GL_DEPTH_COMPONENT, DepthComponent = GL_DEPTH_COMPONENT,
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* Stencil index. * Stencil index.
* @requires_gl44 Extension @extension{ARB,texture_stencil8} for texture * @requires_gl44 Extension @extension{ARB,texture_stencil8} for texture
* data, otherwise for framebuffer reading only. * data, otherwise for framebuffer reading only.
* @requires_es_extension Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil}, * @requires_es_extension Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil},
* for framebuffer reading only. * for framebuffer reading only.
* @requires_gles Stencil index is not available in WebGL.
* @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
@ -240,18 +273,23 @@ enum class ColorFormat: GLenum {
#else #else
StencilIndex = 0x1901, StencilIndex = 0x1901,
#endif #endif
#endif
/** /**
* Depth and stencil. * Depth and stencil.
* @requires_gl30 Extension @extension{ARB,framebuffer_object} * @requires_gl30 Extension @extension{ARB,framebuffer_object}
* @requires_gles30 For texture data only, extension @es_extension{OES,packed_depth_stencil} * @requires_gles30 For texture data only, extension @es_extension{OES,packed_depth_stencil}
* in OpenGL ES 2.0 * in OpenGL ES 2.0.
* @requires_es_extension For framebuffer reading only, extension * @requires_es_extension For framebuffer reading only, extension
* @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil} * @es_extension2{NV,read_depth_stencil,GL_NV_read_depth_stencil}
* @requires_webgl20 For texture data only, extension
* @webgl_extension{WEBGL,depth_texture} in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
DepthStencil = GL_DEPTH_STENCIL DepthStencil = GL_DEPTH_STENCIL
#else #else
/* Using OES version even though WebGL 1.0 *has* DEPTH_STENCIL constant,
because there are no such headers for it */
DepthStencil = GL_DEPTH_STENCIL_OES DepthStencil = GL_DEPTH_STENCIL_OES
#endif #endif
}; };
@ -280,36 +318,46 @@ enum class ColorType: GLenum {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
* Each component signed byte. * Each component signed byte.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES.
* @requires_gles30 For texture data only, only @ref ColorType::UnsignedByte * @requires_gles30 For texture data only, only @ref ColorType::UnsignedByte
* is available in OpenGL ES 2.0. * is available in OpenGL ES 2.0.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_webgl20 For texture data only, only @ref ColorType::UnsignedByte
* is available in WebGL 1.0.
*/ */
Byte = GL_BYTE, Byte = GL_BYTE,
#endif #endif
/** /**
* Each component unsigned short. * Each component unsigned short.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES.
* @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture}
* or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0 * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_webgl20 For texture data only, extension
* @webgl_extension{WEBGL,depth_texture} in WebGL 1.0.
*/ */
UnsignedShort = GL_UNSIGNED_SHORT, UnsignedShort = GL_UNSIGNED_SHORT,
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
* Each component signed short. * Each component signed short.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_gles30 For texture data only, only @ref ColorType::UnsignedShort * @requires_gles30 For texture data only, only @ref ColorType::UnsignedShort
* is available in OpenGL ES 2.0. * is available in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, only @ref ColorType::UnsignedShort
* is available in WebGL 1.0.
*/ */
Short = GL_SHORT, Short = GL_SHORT,
#endif #endif
/** /**
* Each component unsigned int. * Each component unsigned int.
* @requires_gles30 Can't be used for framebuffer reading in OpenGL ES 2.0.
* @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture} * @requires_gles30 For texture data only, extension @es_extension{OES,depth_texture}
* or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0 * or @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, extension
* @webgl_extension{WEBGL,depth_texture} in WebGL 1.0.
*/ */
UnsignedInt = GL_UNSIGNED_INT, UnsignedInt = GL_UNSIGNED_INT,
@ -318,6 +366,8 @@ enum class ColorType: GLenum {
* Each component signed int. * Each component signed int.
* @requires_gles30 Only @ref ColorType::UnsignedInt is available in OpenGL * @requires_gles30 Only @ref ColorType::UnsignedInt is available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Only @ref ColorType::UnsignedInt is available in WebGL
* 1.0.
*/ */
Int = GL_INT, Int = GL_INT,
#endif #endif
@ -327,7 +377,9 @@ enum class ColorType: GLenum {
* @requires_gl30 Extension @extension{ARB,half_float_pixel} * @requires_gl30 Extension @extension{ARB,half_float_pixel}
* @requires_gles30 For texture data only, extension * @requires_gles30 For texture data only, extension
* @es_extension2{OES,texture_half_float,OES_texture_float} in OpenGL * @es_extension2{OES,texture_half_float,OES_texture_float} in OpenGL
* ES 2.0 * ES 2.0.
* @requires_webgl20 For texture data only, extension
* @webgl_extension{OES,texture_half_float} in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
HalfFloat = GL_HALF_FLOAT, HalfFloat = GL_HALF_FLOAT,
@ -338,27 +390,29 @@ enum class ColorType: GLenum {
/** /**
* Each component float. * Each component float.
* @requires_gles30 For texture data only, extension @es_extension{OES,texture_float} * @requires_gles30 For texture data only, extension @es_extension{OES,texture_float}
* in OpenGL ES 2.0 * in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, extension @webgl_extension{OES,texture_float}
* in WebGL 1.0.
*/ */
Float = GL_FLOAT, Float = GL_FLOAT,
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGB, unsigned byte, red and green component 3bit, blue component 2bit. * RGB, unsigned byte, red and green component 3bit, blue component 2bit.
* @requires_gl Packed 12bit types are not available in OpenGL ES. * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL.
*/ */
UnsignedByte332 = GL_UNSIGNED_BYTE_3_3_2, UnsignedByte332 = GL_UNSIGNED_BYTE_3_3_2,
/** /**
* BGR, unsigned byte, red and green component 3bit, blue component 2bit. * BGR, unsigned byte, red and green component 3bit, blue component 2bit.
* @requires_gl Packed 12bit types are not available in OpenGL ES. * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL.
*/ */
UnsignedByte233Rev = GL_UNSIGNED_BYTE_2_3_3_REV, UnsignedByte233Rev = GL_UNSIGNED_BYTE_2_3_3_REV,
#endif #endif
/** /**
* RGB, unsigned byte, red and blue component 5bit, green 6bit. * RGB, unsigned byte, red and blue component 5bit, green 6bit.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL.
*/ */
UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5, UnsignedShort565 = GL_UNSIGNED_SHORT_5_6_5,
@ -366,78 +420,90 @@ enum class ColorType: GLenum {
/** /**
* BGR, unsigned short, red and blue 5bit, green 6bit. * BGR, unsigned short, red and blue 5bit, green 6bit.
* @requires_gl Only @ref ColorType::UnsignedShort565 is available in * @requires_gl Only @ref ColorType::UnsignedShort565 is available in
* OpenGL ES. * OpenGL ES or WebGL.
*/ */
UnsignedShort565Rev = GL_UNSIGNED_SHORT_5_6_5_REV, UnsignedShort565Rev = GL_UNSIGNED_SHORT_5_6_5_REV,
#endif #endif
/** /**
* RGBA, unsigned short, each component 4bit. * RGBA, unsigned short, each component 4bit.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL.
*/ */
UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4,
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* ABGR, unsigned short, each component 4bit. * ABGR, unsigned short, each component 4bit.
* @requires_es_extension For framebuffer reading only, extension * @requires_es_extension For framebuffer reading only, extension
* @es_extension{EXT,read_format_bgra}. * @es_extension{EXT,read_format_bgra}
* @requires_gles Only RGBA component ordering is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV, UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV,
#else #else
UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT,
#endif #endif
#endif
/** /**
* RGBA, unsigned short, each RGB component 5bit, alpha component 1bit. * RGBA, unsigned short, each RGB component 5bit, alpha component 1bit.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES. * @requires_gl Can't be used for framebuffer reading in OpenGL ES or WebGL.
*/ */
UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1, UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1,
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* ABGR, unsigned short, each RGB component 5bit, alpha component 1bit. * ABGR, unsigned short, each RGB component 5bit, alpha component 1bit.
* @requires_es_extension For framebuffer reading only, extension * @requires_es_extension For framebuffer reading only, extension
* @es_extension{EXT,read_format_bgra}. * @es_extension{EXT,read_format_bgra}
* @requires_gles Not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV, UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV,
#else #else
UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGBA, unsigned int, each component 8bit. * RGBA, unsigned int, each component 8bit.
* @requires_gl Use @ref ColorType::UnsignedByte in OpenGL ES instead. * @requires_gl Use @ref ColorType::UnsignedByte in OpenGL ES and WebGL
* instead.
*/ */
UnsignedInt8888 = GL_UNSIGNED_INT_8_8_8_8, UnsignedInt8888 = GL_UNSIGNED_INT_8_8_8_8,
/** /**
* ABGR, unsigned int, each component 8bit. * ABGR, unsigned int, each component 8bit.
* @requires_gl Only RGBA component ordering is available in OpenGL ES, see * @requires_gl Only RGBA component ordering is available in OpenGL ES and
* @ref ColorType::UnsignedInt8888 for more information. * WebGL, see @ref ColorType::UnsignedInt8888 for more information.
*/ */
UnsignedInt8888Rev = GL_UNSIGNED_INT_8_8_8_8_REV, UnsignedInt8888Rev = GL_UNSIGNED_INT_8_8_8_8_REV,
/** /**
* RGBA, unsigned int, each RGB component 10bit, alpha component 2bit. * RGBA, unsigned int, each RGB component 10bit, alpha component 2bit.
* @requires_gl Only @ref ColorType::UnsignedInt2101010Rev is available in * @requires_gl Only @ref ColorType::UnsignedInt2101010Rev is available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
UnsignedInt1010102 = GL_UNSIGNED_INT_10_10_10_2, UnsignedInt1010102 = GL_UNSIGNED_INT_10_10_10_2,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* ABGR, unsigned int, each RGB component 10bit, alpha component 2bit. * ABGR, unsigned int, each RGB component 10bit, alpha component 2bit.
* @requires_gles30 Can't be used for framebuffer reading in OpenGL ES 2.0. * @requires_gles30 Can't be used for framebuffer reading in OpenGL ES 2.0.
* @requires_gles30 For texture data only, extension * @requires_gles30 For texture data only, extension
* @es_extension{EXT,texture_type_2_10_10_10_REV} in OpenGL ES 2.0 * @es_extension{EXT,texture_type_2_10_10_10_REV} in OpenGL ES 2.0.
* Not available in WebGL 1.0.
* @requires_webgl20 Only RGBA component ordering is available in WebGL
* 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV, UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV,
#else #else
UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV_EXT, UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -445,6 +511,7 @@ enum class ColorType: GLenum {
* @requires_gl30 Extension @extension{EXT,packed_float} * @requires_gl30 Extension @extension{EXT,packed_float}
* @requires_gles30 Floating-point types are not available in OpenGL ES * @requires_gles30 Floating-point types are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Floating-point types are not available in WebGL 1.0.
*/ */
UnsignedInt10F11F11FRev = GL_UNSIGNED_INT_10F_11F_11F_REV, UnsignedInt10F11F11FRev = GL_UNSIGNED_INT_10F_11F_11F_REV,
@ -453,6 +520,7 @@ enum class ColorType: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_shared_exponent} * @requires_gl30 Extension @extension{EXT,texture_shared_exponent}
* @requires_gles30 Only 8bit and 16bit types are available in OpenGL ES * @requires_gles30 Only 8bit and 16bit types are available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Only 8bit and 16bit types are available in WebGL 1.0.
*/ */
UnsignedInt5999Rev = GL_UNSIGNED_INT_5_9_9_9_REV, UnsignedInt5999Rev = GL_UNSIGNED_INT_5_9_9_9_REV,
#endif #endif
@ -460,8 +528,10 @@ enum class ColorType: GLenum {
/** /**
* Unsigned int, depth component 24bit, stencil index 8bit. * Unsigned int, depth component 24bit, stencil index 8bit.
* @requires_gl30 Extension @extension{ARB,framebuffer_object} * @requires_gl30 Extension @extension{ARB,framebuffer_object}
* @requires_gles30 For texture data only, extension @es_extension{OES,packed_depth_stencil} * @requires_gles30 For texture data only, extension
* in OpenGL ES 2.0 * @es_extension{OES,packed_depth_stencil} in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, extension
* @webgl_extension{WEBGL,depth_texture} in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
UnsignedInt248 = GL_UNSIGNED_INT_24_8, UnsignedInt248 = GL_UNSIGNED_INT_24_8,
@ -476,6 +546,8 @@ enum class ColorType: GLenum {
* @requires_gl30 Extension @extension{ARB,depth_buffer_float} * @requires_gl30 Extension @extension{ARB,depth_buffer_float}
* @requires_gles30 For texture data only, only @ref ColorType::UnsignedInt248 * @requires_gles30 For texture data only, only @ref ColorType::UnsignedInt248
* is available in OpenGL ES 2.0. * is available in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, only @ref ColorType::UnsignedInt248
* is available in WebGL 1.0.
*/ */
Float32UnsignedInt248Rev = GL_FLOAT_32_UNSIGNED_INT_24_8_REV Float32UnsignedInt248Rev = GL_FLOAT_32_UNSIGNED_INT_24_8_REV
#endif #endif

129
src/Magnum/RenderbufferFormat.h

@ -45,76 +45,85 @@ enum class RenderbufferFormat: GLenum {
/** /**
* Red component, normalized unsigned, size implementation-dependent. * Red component, normalized unsigned, size implementation-dependent.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Use exactly specified format in OpenGL ES instead. * @requires_gl Use exactly specified format in OpenGL ES or WebGL instead.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::R8. * format, e.g. @ref RenderbufferFormat::R8.
*/ */
Red = GL_RED, Red = GL_RED,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Red component, normalized unsigned byte. * Red component, normalized unsigned byte.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES * @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES
* 2.0 * 2.0.
* @requires_webgl20 Not available in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
R8 = GL_R8, R8 = GL_R8,
#else #else
R8 = GL_R8_EXT, R8 = GL_R8_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Red and green component, normalized unsigned, size * Red and green component, normalized unsigned, size
* implementation-dependent. * implementation-dependent.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Use exactly specified format in OpenGL ES instead. * @requires_gl Use exactly specified format in OpenGL ES or WebGL instead.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::RG8. * format, e.g. @ref RenderbufferFormat::RG8.
*/ */
RG = GL_RG, RG = GL_RG,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Red and green component, each normalized unsigned byte. * Red and green component, each normalized unsigned byte.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES * @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES
* 2.0 * 2.0.
* @requires_webgl20 Not available in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RG8 = GL_RG8, RG8 = GL_RG8,
#else #else
RG8 = GL_RG8_EXT, RG8 = GL_RG8_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGBA, normalized unsigned, size implementation-dependent. * RGBA, normalized unsigned, size implementation-dependent.
* @requires_gl Use exactly specified format in OpenGL ES 2.0 instead. * @requires_gl Use exactly specified format in OpenGL ES or WebGL instead.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::RGBA8. * format, e.g. @ref RenderbufferFormat::RGBA8.
*/ */
RGBA = GL_RGBA, RGBA = GL_RGBA,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* RGBA, each component normalized unsigned byte. * RGBA, each component normalized unsigned byte.
* @requires_gles30 Extension @es_extension{ARM,rgba8} or @es_extension{OES,rgb8_rgba8} * @requires_gles30 Extension @es_extension{ARM,rgba8} or @es_extension{OES,rgb8_rgba8}
* in OpenGL ES 2.0 * in OpenGL ES 2.0.
* @requires_webgl20 Not available in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RGBA8 = GL_RGBA8, RGBA8 = GL_RGBA8,
#else #else
RGBA8 = GL_RGBA8_OES, RGBA8 = GL_RGBA8_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Red component, normalized unsigned short. * Red component, normalized unsigned short.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
R16 = GL_R16, R16 = GL_R16,
@ -122,21 +131,21 @@ enum class RenderbufferFormat: GLenum {
* Red and green component, each normalized unsigned short. * Red and green component, each normalized unsigned short.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RG16 = GL_RG16, RG16 = GL_RG16,
/** /**
* RGB, each component normalized unsigned short. * RGB, each component normalized unsigned short.
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGB16 = GL_RGB16, RGB16 = GL_RGB16,
/** /**
* RGBA, each component normalized unsigned short. * RGBA, each component normalized unsigned short.
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGBA16 = GL_RGBA16, RGBA16 = GL_RGBA16,
#endif #endif
@ -147,6 +156,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R8UI = GL_R8UI, R8UI = GL_R8UI,
@ -155,6 +166,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG8UI = GL_RG8UI, RG8UI = GL_RG8UI,
@ -163,6 +176,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA8UI = GL_RGBA8UI, RGBA8UI = GL_RGBA8UI,
@ -171,6 +186,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R8I = GL_R8I, R8I = GL_R8I,
@ -179,6 +196,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG8I = GL_RG8I, RG8I = GL_RG8I,
@ -187,6 +206,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA8I = GL_RGBA8I, RGBA8I = GL_RGBA8I,
@ -195,6 +216,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R16UI = GL_R16UI, R16UI = GL_R16UI,
@ -203,6 +226,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG16UI = GL_RG16UI, RG16UI = GL_RG16UI,
@ -211,6 +236,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA16UI = GL_RGBA16UI, RGBA16UI = GL_RGBA16UI,
@ -219,6 +246,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R16I = GL_R16I, R16I = GL_R16I,
@ -227,6 +256,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG16I = GL_RG16I, RG16I = GL_RG16I,
@ -235,6 +266,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA16I = GL_RGBA16I, RGBA16I = GL_RGBA16I,
@ -243,6 +276,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R32UI = GL_R32UI, R32UI = GL_R32UI,
@ -251,6 +286,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG32UI = GL_RG32UI, RG32UI = GL_RG32UI,
@ -259,6 +296,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA32UI = GL_RGBA32UI, RGBA32UI = GL_RGBA32UI,
@ -267,6 +306,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R32I = GL_R32I, R32I = GL_R32I,
@ -275,6 +316,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG32I = GL_RG32I, RG32I = GL_RG32I,
@ -283,6 +326,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA32I = GL_RGBA32I, RGBA32I = GL_RGBA32I,
#endif #endif
@ -292,7 +337,7 @@ enum class RenderbufferFormat: GLenum {
* Red component, half float. * Red component, half float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
R16F = GL_R16F, R16F = GL_R16F,
@ -300,7 +345,7 @@ enum class RenderbufferFormat: GLenum {
* Red and green component, each half float. * Red and green component, each half float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
RG16F = GL_RG16F, RG16F = GL_RG16F,
@ -308,7 +353,7 @@ enum class RenderbufferFormat: GLenum {
* RGBA, each component half float. * RGBA, each component half float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
RGBA16F = GL_RGBA16F, RGBA16F = GL_RGBA16F,
@ -316,7 +361,7 @@ enum class RenderbufferFormat: GLenum {
* Red component, float. * Red component, float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
R32F = GL_R32F, R32F = GL_R32F,
@ -324,7 +369,7 @@ enum class RenderbufferFormat: GLenum {
* Red and green component, each float. * Red and green component, each float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
RG32F = GL_RG32F, RG32F = GL_RG32F,
@ -332,7 +377,7 @@ enum class RenderbufferFormat: GLenum {
* RGBA, each component float. * RGBA, each component float.
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gl Only (non)normalized integral formats are available in * @requires_gl Only (non)normalized integral formats are available in
* OpenGL ES. * OpenGL ES and WebGL.
*/ */
RGBA32F = GL_RGBA32F, RGBA32F = GL_RGBA32F,
#endif #endif
@ -342,6 +387,7 @@ enum class RenderbufferFormat: GLenum {
* RGBA, normalized unsigned, each RGB component 10bit, alpha 2bit. * RGBA, normalized unsigned, each RGB component 10bit, alpha 2bit.
* @requires_gles30 Usable only as internal texture format in OpenGL ES * @requires_gles30 Usable only as internal texture format in OpenGL ES
* 2.0, see @ref TextureFormat::RGB10A2. * 2.0, see @ref TextureFormat::RGB10A2.
* @requires_webgl20 Not available in WebGL 1.0.
*/ */
RGB10A2 = GL_RGB10_A2, RGB10A2 = GL_RGB10_A2,
@ -350,6 +396,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl33 Extension @extension{ARB,texture_rgb10_a2ui} * @requires_gl33 Extension @extension{ARB,texture_rgb10_a2ui}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB10A2UI = GL_RGB10_A2UI, RGB10A2UI = GL_RGB10_A2UI,
#endif #endif
@ -364,8 +412,8 @@ enum class RenderbufferFormat: GLenum {
/** /**
* RGB, float, red and green 11bit, blue 10bit. * RGB, float, red and green 11bit, blue 10bit.
* @requires_gl30 Extension @extension{EXT,packed_float} * @requires_gl30 Extension @extension{EXT,packed_float}
* @requires_gl Usable only as internal texture format in OpenGL ES, see * @requires_gl Usable only as internal texture format in OpenGL ES and
* @ref TextureFormat::R11FG11FB10F. * WebGL, see @ref TextureFormat::R11FG11FB10F.
*/ */
R11FG11FB10F = GL_R11F_G11F_B10F, R11FG11FB10F = GL_R11F_G11F_B10F,
#endif #endif
@ -375,7 +423,8 @@ enum class RenderbufferFormat: GLenum {
/** /**
* sRGBA, each component normalized unsigned byte. * sRGBA, each component normalized unsigned byte.
* @requires_gles30 Extension @es_extension{EXT,sRGB} in OpenGL ES 2.0 * @requires_gles30 Extension @es_extension{EXT,sRGB} in OpenGL ES 2.0.
* @requires_webgl20 Extension @webgl_extension{EXT,sRGB} in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
SRGB8Alpha8 = GL_SRGB8_ALPHA8, SRGB8Alpha8 = GL_SRGB8_ALPHA8,
@ -387,7 +436,8 @@ enum class RenderbufferFormat: GLenum {
/** /**
* Depth component, size implementation-dependent. * Depth component, size implementation-dependent.
* @todo is this allowed in core? * @todo is this allowed in core?
* @requires_gl Use exactly specified format in OpenGL ES instead. * @requires_gl Use exactly specified format in OpenGL ES and WebGL
* instead.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::DepthComponent16. * format, e.g. @ref RenderbufferFormat::DepthComponent16.
*/ */
@ -397,25 +447,31 @@ enum class RenderbufferFormat: GLenum {
/** Depth component, 16bit. */ /** Depth component, 16bit. */
DepthComponent16 = GL_DEPTH_COMPONENT16, DepthComponent16 = GL_DEPTH_COMPONENT16,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Depth component, 24bit. * Depth component, 24bit.
* @requires_gles30 Extension @es_extension{OES,depth24} in OpenGL ES 2.0 * @requires_gles30 Extension @es_extension{OES,depth24} in OpenGL ES 2.0.
* @requires_webgl20 Only 16bit depth component is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
DepthComponent24 = GL_DEPTH_COMPONENT24, DepthComponent24 = GL_DEPTH_COMPONENT24,
#else #else
DepthComponent24 = GL_DEPTH_COMPONENT24_OES, DepthComponent24 = GL_DEPTH_COMPONENT24_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* Depth component, 32bit. * Depth component, 32bit.
* @requires_es_extension Extension @es_extension{OES,depth32} * @requires_es_extension Extension @es_extension{OES,depth32}
* @requires_gles At most 24bit depth component is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
DepthComponent32 = GL_DEPTH_COMPONENT32, DepthComponent32 = GL_DEPTH_COMPONENT32,
#else #else
DepthComponent32 = GL_DEPTH_COMPONENT32_OES, DepthComponent32 = GL_DEPTH_COMPONENT32_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -423,6 +479,8 @@ enum class RenderbufferFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,depth_buffer_float} * @requires_gl30 Extension @extension{ARB,depth_buffer_float}
* @requires_gles30 Only integral depth textures are available in OpenGL ES * @requires_gles30 Only integral depth textures are available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Only integral depth textures are available in WebGL
* 1.0.
*/ */
DepthComponent32F = GL_DEPTH_COMPONENT32F, DepthComponent32F = GL_DEPTH_COMPONENT32F,
#endif #endif
@ -430,16 +488,19 @@ enum class RenderbufferFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* Stencil index, size implementation-dependent. * Stencil index, size implementation-dependent.
* @requires_gl Use exactly specified format in OpenGL ES instead. * @requires_gl Use exactly specified format in OpenGL ES and WebGL
* instead.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::StencilIndex8. * format, e.g. @ref RenderbufferFormat::StencilIndex8.
*/ */
StencilIndex = GL_STENCIL_INDEX, StencilIndex = GL_STENCIL_INDEX,
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* 1-bit stencil index. * 1-bit stencil index.
* @requires_es_extension Extension @es_extension{OES,stencil1} * @requires_es_extension Extension @es_extension{OES,stencil1}
* @requires_gles Only 8bit stencil index is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
StencilIndex1 = GL_STENCIL_INDEX1, StencilIndex1 = GL_STENCIL_INDEX1,
@ -450,12 +511,14 @@ enum class RenderbufferFormat: GLenum {
/** /**
* 4-bit stencil index. * 4-bit stencil index.
* @requires_es_extension Extension @es_extension{OES,stencil4} * @requires_es_extension Extension @es_extension{OES,stencil4}
* @requires_gles Only 8bit stencil index is available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
StencilIndex4 = GL_STENCIL_INDEX4, StencilIndex4 = GL_STENCIL_INDEX4,
#else #else
StencilIndex4 = GL_STENCIL_INDEX4_OES, StencilIndex4 = GL_STENCIL_INDEX4_OES,
#endif #endif
#endif
/** 8-bit stencil index. */ /** 8-bit stencil index. */
StencilIndex8 = GL_STENCIL_INDEX8, StencilIndex8 = GL_STENCIL_INDEX8,
@ -463,34 +526,50 @@ enum class RenderbufferFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* 16-bit stencil index. * 16-bit stencil index.
* @requires_gl At most 8bit stencil index is available in OpenGL ES. * @requires_gl At most 8bit stencil index is available in OpenGL ES and
* WebGL.
*/ */
StencilIndex16 = GL_STENCIL_INDEX16, StencilIndex16 = GL_STENCIL_INDEX16,
#endif
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_WEBGL)
/** /**
* Depth and stencil component, size implementation-dependent. * Depth and stencil component, size implementation-dependent.
* @requires_gl Use exactly specified format in OpenGL ES instead. * @requires_gl Use exactly specified format in OpenGL ES instead. This is,
* however, available in WebGL 1.0.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref RenderbufferFormat::Depth24Stencil8. * format, e.g. @ref RenderbufferFormat::Depth24Stencil8.
*/ */
#ifndef MAGNUM_TARGET_GLES
DepthStencil = GL_DEPTH_STENCIL, DepthStencil = GL_DEPTH_STENCIL,
#else
DepthStencil = GL_DEPTH_STENCIL_OES,
#endif
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* 24bit depth and 8bit stencil component. * 24bit depth and 8bit stencil component.
* @requires_gles30 Extension @es_extension{OES,packed_depth_stencil} in * @requires_gles30 Extension @es_extension{OES,packed_depth_stencil} in
* OpenGL ES 2.0 * OpenGL ES 2.0.
* @requires_webgl20 Use @ref RenderbufferFormat::DepthStencil in WebGL
* 1.0 instead.
*/ */
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
Depth24Stencil8 = GL_DEPTH24_STENCIL8_OES Depth24Stencil8 = GL_DEPTH24_STENCIL8_OES
#else #else
Depth24Stencil8 = GL_DEPTH24_STENCIL8, Depth24Stencil8 = GL_DEPTH24_STENCIL8,
#endif
#endif
#ifndef MAGNUM_TARGET_GLES2
/** /**
* 32bit float depth component and 8bit stencil component. * 32bit float depth component and 8bit stencil component.
* @requires_gl30 Extension @extension{ARB,depth_buffer_float} * @requires_gl30 Extension @extension{ARB,depth_buffer_float}
* @requires_gles30 Only integral depth textures are available in OpenGL ES * @requires_gles30 Only integral depth textures are available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Only integral depth textures are available in WebGL
* 1.0.
*/ */
Depth32FStencil8 = GL_DEPTH32F_STENCIL8 Depth32FStencil8 = GL_DEPTH32F_STENCIL8
#endif #endif

21
src/Magnum/Text/DistanceFieldGlyphCache.cpp

@ -39,10 +39,12 @@ namespace Magnum { namespace Text {
DistanceFieldGlyphCache::DistanceFieldGlyphCache(const Vector2i& originalSize, const Vector2i& size, const UnsignedInt radius): DistanceFieldGlyphCache::DistanceFieldGlyphCache(const Vector2i& originalSize, const Vector2i& size, const UnsignedInt radius):
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES3) #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES3)
GlyphCache(TextureFormat::R8, originalSize, size, Vector2i(radius)), GlyphCache(TextureFormat::R8, originalSize, size, Vector2i(radius)),
#else #elif !defined(MAGNUM_TARGET_WEBGL)
/* Luminance is not renderable in most cases */ /* Luminance is not renderable in most cases */
GlyphCache(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>() ? GlyphCache(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>() ?
TextureFormat::Red : TextureFormat::RGB, originalSize, size, Vector2i(radius)), TextureFormat::Red : TextureFormat::RGB, originalSize, size, Vector2i(radius)),
#else
GlyphCache(TextureFormat::RGB, originalSize, size, Vector2i(radius)),
#endif #endif
scale(Vector2(size)/Vector2(originalSize)), radius(radius) scale(Vector2(size)/Vector2(originalSize)), radius(radius)
{ {
@ -50,7 +52,7 @@ DistanceFieldGlyphCache::DistanceFieldGlyphCache(const Vector2i& originalSize, c
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::texture_rg); MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::texture_rg);
#endif #endif
#ifdef MAGNUM_TARGET_GLES2 #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* Luminance is not renderable in most cases */ /* Luminance is not renderable in most cases */
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>())
Warning() << "Text::DistanceFieldGlyphCache:" << Extensions::GL::EXT::texture_rg::string() << "not supported, using inefficient RGB format for glyph cache texture"; Warning() << "Text::DistanceFieldGlyphCache:" << Extensions::GL::EXT::texture_rg::string() << "not supported, using inefficient RGB format for glyph cache texture";
@ -64,11 +66,14 @@ void DistanceFieldGlyphCache::setImage(const Vector2i& offset, const ImageRefere
"Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), );
#else #else
TextureFormat internalFormat; TextureFormat internalFormat;
#ifndef MAGNUM_TARGET_WEBGL
if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) { if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) {
internalFormat = TextureFormat::Red; internalFormat = TextureFormat::Red;
CORRADE_ASSERT(image.format() == ColorFormat::Red, CORRADE_ASSERT(image.format() == ColorFormat::Red,
"Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Red << "but got" << image.format(), );
} else { } else
#endif
{
internalFormat = TextureFormat::Luminance; internalFormat = TextureFormat::Luminance;
CORRADE_ASSERT(image.format() == ColorFormat::Luminance, CORRADE_ASSERT(image.format() == ColorFormat::Luminance,
"Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Luminance << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setImage(): expected" << ColorFormat::Luminance << "but got" << image.format(), );
@ -90,13 +95,17 @@ void DistanceFieldGlyphCache::setDistanceFieldImage(const Vector2i& offset, cons
CORRADE_ASSERT(image.format() == ColorFormat::Red, CORRADE_ASSERT(image.format() == ColorFormat::Red,
"Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), );
#else #else
#ifndef MAGNUM_TARGET_WEBGL
if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>())
CORRADE_ASSERT(image.format() == ColorFormat::Red, CORRADE_ASSERT(image.format() == ColorFormat::Red,
"Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::Red << "but got" << image.format(), );
else
/* Luminance is not renderable in most cases */ #endif
else CORRADE_ASSERT(image.format() == ColorFormat::RGB, {
/* Luminance is not renderable in most cases */
CORRADE_ASSERT(image.format() == ColorFormat::RGB,
"Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::RGB << "but got" << image.format(), ); "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ColorFormat::RGB << "but got" << image.format(), );
}
#endif #endif
texture().setSubImage(0, offset, image); texture().setSubImage(0, offset, image);

4
src/Magnum/Text/GlyphCache.cpp

@ -49,12 +49,14 @@ GlyphCache::GlyphCache(const Vector2i& originalSize, const Vector2i& size, const
/** @todo Is there any better way to select proper sized/unsized format on ES2? */ /** @todo Is there any better way to select proper sized/unsized format on ES2? */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
const TextureFormat internalFormat = TextureFormat::R8; const TextureFormat internalFormat = TextureFormat::R8;
#else #elif !defined(MAGNUM_TARGET_WEBGL)
TextureFormat internalFormat; TextureFormat internalFormat;
if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) { if(Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>()) {
internalFormat = Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_storage>() ? internalFormat = Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_storage>() ?
TextureFormat::R8 : TextureFormat::Red; TextureFormat::R8 : TextureFormat::Red;
} else internalFormat = TextureFormat::Luminance; } else internalFormat = TextureFormat::Luminance;
#else
const TextureFormat internalFormat = TextureFormat::Luminance;
#endif #endif
initialize(internalFormat, size); initialize(internalFormat, size);

242
src/Magnum/TextureFormat.h

@ -46,6 +46,7 @@ or WebGL.
@see @ref Texture, @ref CubeMapTexture, @ref CubeMapTextureArray @see @ref Texture, @ref CubeMapTexture, @ref CubeMapTextureArray
*/ */
enum class TextureFormat: GLenum { enum class TextureFormat: GLenum {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Red component, normalized unsigned, size implementation-dependent. Not * Red component, normalized unsigned, size implementation-dependent. Not
* allowed in unemulated @ref Texture::setStorage() "*Texture::setStorage()" * allowed in unemulated @ref Texture::setStorage() "*Texture::setStorage()"
@ -53,7 +54,9 @@ enum class TextureFormat: GLenum {
* instead. * instead.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES * @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES
* 2.0 * 2.0.
* @requires_webgl20 Not available in WebGL 1.0, see @ref TextureFormat::Luminance
* for an alternative.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref TextureFormat::R8. * format, e.g. @ref TextureFormat::R8.
*/ */
@ -70,13 +73,17 @@ enum class TextureFormat: GLenum {
* @es_extension{EXT,texture_storage} in OpenGL ES 2.0. For texture * @es_extension{EXT,texture_storage} in OpenGL ES 2.0. For texture
* storage only, for image specification use @ref TextureFormat::Red * storage only, for image specification use @ref TextureFormat::Red
* instead. * instead.
* @requires_webgl20 Not available in WebGL 1.0, see @ref TextureFormat::Luminance
* for an alternative.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
R8 = GL_R8, R8 = GL_R8,
#else #else
R8 = GL_R8_EXT, R8 = GL_R8_EXT,
#endif #endif
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Red and green component, normalized unsigned, size * Red and green component, normalized unsigned, size
* implementation-dependent. Not allowed in unemulated * implementation-dependent. Not allowed in unemulated
@ -84,7 +91,9 @@ enum class TextureFormat: GLenum {
* use @ref TextureFormat::RG8 "TextureFormat::RG8" instead. * use @ref TextureFormat::RG8 "TextureFormat::RG8" instead.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES * @requires_gles30 Extension @es_extension{EXT,texture_rg} in OpenGL ES
* 2.0 * 2.0.
* @requires_webgl20 Not available in WebGL 1.0, see
* @ref TextureFormat::LuminanceAlpha for an alternative.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref TextureFormat::RG8. * format, e.g. @ref TextureFormat::RG8.
*/ */
@ -101,12 +110,15 @@ enum class TextureFormat: GLenum {
* @es_extension{EXT,texture_storage} in OpenGL ES 2.0. For texture * @es_extension{EXT,texture_storage} in OpenGL ES 2.0. For texture
* storage only, for image specification use @ref TextureFormat::RG * storage only, for image specification use @ref TextureFormat::RG
* instead. * instead.
* @requires_webgl20 Not available in WebGL 1.0, see
* @ref TextureFormat::LuminanceAlpha for an alternative.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RG8 = GL_RG8, RG8 = GL_RG8,
#else #else
RG8 = GL_RG8_EXT, RG8 = GL_RG8_EXT,
#endif #endif
#endif
/** /**
* RGB, normalized unsigned, size implementation-dependent. Not allowed in * RGB, normalized unsigned, size implementation-dependent. Not allowed in
@ -117,17 +129,22 @@ enum class TextureFormat: GLenum {
*/ */
RGB = GL_RGB, RGB = GL_RGB,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* RGB, each component normalized unsigned byte. * RGB, each component normalized unsigned byte.
* @requires_gles30 Extension @es_extension{OES,required_internalformat} * @requires_gles30 Extension @es_extension{OES,required_internalformat}
* (for image specification) or @es_extension{EXT,texture_storage} * (for image specification) or @es_extension{EXT,texture_storage}
* (for texture storage) in OpenGL ES 2.0 * (for texture storage) in OpenGL ES 2.0. Use @ref TextureFormat::RGB
* otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use
* @ref TextureFormat::RGB instead.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RGB8 = GL_RGB8, RGB8 = GL_RGB8,
#else #else
RGB8 = GL_RGB8_OES, RGB8 = GL_RGB8_OES,
#endif #endif
#endif
/** /**
* RGBA, normalized unsigned, size implementation-dependent. Not allowed in * RGBA, normalized unsigned, size implementation-dependent. Not allowed in
@ -138,23 +155,29 @@ enum class TextureFormat: GLenum {
*/ */
RGBA = GL_RGBA, RGBA = GL_RGBA,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* RGBA, each component normalized unsigned byte. * RGBA, each component normalized unsigned byte.
* @requires_gles30 Extension @es_extension{OES,required_internalformat} * @requires_gles30 Extension @es_extension{OES,required_internalformat}
* (for image specification) or @es_extension{EXT,texture_storage} * (for image specification) or @es_extension{EXT,texture_storage}
* (for texture storage) in OpenGL ES 2.0 * (for texture storage) in OpenGL ES 2.0. Use @ref TextureFormat::RGBA
* otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use
* @ref TextureFormat::RGBA instead.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RGBA8 = GL_RGBA8, RGBA8 = GL_RGBA8,
#else #else
RGBA8 = GL_RGBA8_OES, RGBA8 = GL_RGBA8_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
* Red component, normalized signed byte. * Red component, normalized signed byte.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0. * @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0.
* @requires_webgl20 Only unsigned formats are available in WebGL 1.0.
*/ */
R8Snorm = GL_R8_SNORM, R8Snorm = GL_R8_SNORM,
@ -162,6 +185,7 @@ enum class TextureFormat: GLenum {
* Red and green component, each normalized signed byte. * Red and green component, each normalized signed byte.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0. * @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0.
* @requires_webgl20 Only unsigned formats are available in WebGL 1.0.
*/ */
RG8Snorm = GL_RG8_SNORM, RG8Snorm = GL_RG8_SNORM,
@ -169,6 +193,7 @@ enum class TextureFormat: GLenum {
* RGB, each component normalized signed byte. * RGB, each component normalized signed byte.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0. * @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0.
* @requires_webgl20 Only unsigned formats are available in WebGL 1.0.
*/ */
RGB8Snorm = GL_RGB8_SNORM, RGB8Snorm = GL_RGB8_SNORM,
@ -176,6 +201,7 @@ enum class TextureFormat: GLenum {
* RGBA, each component normalized signed byte. * RGBA, each component normalized signed byte.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0. * @requires_gles30 Only unsigned formats are available in OpenGL ES 2.0.
* @requires_webgl20 Only unsigned formats are available in WebGL 1.0.
*/ */
RGBA8Snorm = GL_RGBA8_SNORM, RGBA8Snorm = GL_RGBA8_SNORM,
#endif #endif
@ -185,7 +211,7 @@ enum class TextureFormat: GLenum {
* Red component, normalized unsigned short. * Red component, normalized unsigned short.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
R16 = GL_R16, R16 = GL_R16,
@ -193,21 +219,21 @@ enum class TextureFormat: GLenum {
* Red and green component, each normalized unsigned short. * Red and green component, each normalized unsigned short.
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RG16 = GL_RG16, RG16 = GL_RG16,
/** /**
* RGB, each component normalized unsigned short. * RGB, each component normalized unsigned short.
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGB16 = GL_RGB16, RGB16 = GL_RGB16,
/** /**
* RGBA, each component normalized unsigned short. * RGBA, each component normalized unsigned short.
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGBA16 = GL_RGBA16, RGBA16 = GL_RGBA16,
@ -215,7 +241,7 @@ enum class TextureFormat: GLenum {
* Red component, normalized signed short. * Red component, normalized signed short.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
R16Snorm = GL_R16_SNORM, R16Snorm = GL_R16_SNORM,
@ -223,7 +249,7 @@ enum class TextureFormat: GLenum {
* Red and green component, each normalized signed short. * Red and green component, each normalized signed short.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RG16Snorm = GL_RG16_SNORM, RG16Snorm = GL_RG16_SNORM,
@ -231,7 +257,7 @@ enum class TextureFormat: GLenum {
* RGB, each component normalized signed short. * RGB, each component normalized signed short.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGB16Snorm = GL_RGB16_SNORM, RGB16Snorm = GL_RGB16_SNORM,
@ -239,7 +265,7 @@ enum class TextureFormat: GLenum {
* RGBA, each component normalized signed short. * RGBA, each component normalized signed short.
* @requires_gl31 Extension @extension{EXT,texture_snorm} * @requires_gl31 Extension @extension{EXT,texture_snorm}
* @requires_gl Only byte-sized normalized formats are available in OpenGL * @requires_gl Only byte-sized normalized formats are available in OpenGL
* ES. * ES and WebGL.
*/ */
RGBA16Snorm = GL_RGBA16_SNORM, RGBA16Snorm = GL_RGBA16_SNORM,
#endif #endif
@ -250,6 +276,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R8UI = GL_R8UI, R8UI = GL_R8UI,
@ -258,6 +286,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG8UI = GL_RG8UI, RG8UI = GL_RG8UI,
@ -266,6 +296,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB8UI = GL_RGB8UI, RGB8UI = GL_RGB8UI,
@ -274,6 +306,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA8UI = GL_RGBA8UI, RGBA8UI = GL_RGBA8UI,
@ -282,6 +316,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R8I = GL_R8I, R8I = GL_R8I,
@ -290,6 +326,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG8I = GL_RG8I, RG8I = GL_RG8I,
@ -298,6 +336,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB8I = GL_RGB8I, RGB8I = GL_RGB8I,
@ -306,6 +346,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA8I = GL_RGBA8I, RGBA8I = GL_RGBA8I,
@ -314,6 +356,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R16UI = GL_R16UI, R16UI = GL_R16UI,
@ -322,6 +366,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG16UI = GL_RG16UI, RG16UI = GL_RG16UI,
@ -330,6 +376,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB16UI = GL_RGB16UI, RGB16UI = GL_RGB16UI,
@ -338,6 +386,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA16UI = GL_RGBA16UI, RGBA16UI = GL_RGBA16UI,
@ -346,6 +396,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R16I = GL_R16I, R16I = GL_R16I,
@ -354,6 +406,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG16I = GL_RG16I, RG16I = GL_RG16I,
@ -362,6 +416,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB16I = GL_RGB16I, RGB16I = GL_RGB16I,
@ -370,6 +426,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA16I = GL_RGBA16I, RGBA16I = GL_RGBA16I,
@ -378,6 +436,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R32UI = GL_R32UI, R32UI = GL_R32UI,
@ -386,6 +446,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG32UI = GL_RG32UI, RG32UI = GL_RG32UI,
@ -394,6 +456,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB32UI = GL_RGB32UI, RGB32UI = GL_RGB32UI,
@ -402,6 +466,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA32UI = GL_RGBA32UI, RGBA32UI = GL_RGBA32UI,
@ -410,6 +476,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R32I = GL_R32I, R32I = GL_R32I,
@ -418,6 +486,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG32I = GL_RG32I, RG32I = GL_RG32I,
@ -426,6 +496,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB32I = GL_RGB32I, RGB32I = GL_RGB32I,
@ -434,6 +506,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA32I = GL_RGBA32I, RGBA32I = GL_RGBA32I,
@ -442,6 +516,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R16F = GL_R16F, R16F = GL_R16F,
@ -450,6 +526,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG16F = GL_RG16F, RG16F = GL_RG16F,
@ -458,6 +536,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB16F = GL_RGB16F, RGB16F = GL_RGB16F,
@ -466,6 +546,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA16F = GL_RGBA16F, RGBA16F = GL_RGBA16F,
@ -474,6 +556,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R32F = GL_R32F, R32F = GL_R32F,
@ -482,6 +566,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_rg} and @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RG32F = GL_RG32F, RG32F = GL_RG32F,
@ -490,6 +576,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB32F = GL_RGB32F, RGB32F = GL_RGB32F,
@ -498,6 +586,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,texture_float} * @requires_gl30 Extension @extension{ARB,texture_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGBA32F = GL_RGBA32F, RGBA32F = GL_RGBA32F,
#endif #endif
@ -507,8 +597,8 @@ enum class TextureFormat: GLenum {
* Luminance, normalized unsigned, single value used for all RGB channels. * Luminance, normalized unsigned, single value used for all RGB channels.
* Size implementation-dependent. Not allowed in unemulated * Size implementation-dependent. Not allowed in unemulated
* @ref Texture::setStorage() "*Texture::setStorage()" calls. * @ref Texture::setStorage() "*Texture::setStorage()" calls.
* @requires_gles20 Not available in ES 3.0 or desktop OpenGL. Use * @requires_gles20 Not available in OpenGL ES 3.0, WebGL 2.0 or desktop
* @ref TextureFormat::R8 instead. * OpenGL. Use @ref TextureFormat::R8 instead.
* @deprecated_gl Included for compatibility reasons only, use * @deprecated_gl Included for compatibility reasons only, use
* @ref TextureFormat::R8 instead. * @ref TextureFormat::R8 instead.
*/ */
@ -519,8 +609,8 @@ enum class TextureFormat: GLenum {
* RGB channels, second value is used for alpha channel. Size * RGB channels, second value is used for alpha channel. Size
* implementation-dependent. Not allowed in unemulated * implementation-dependent. Not allowed in unemulated
* @ref Texture::setStorage() "*Texture::setStorage()" calls. * @ref Texture::setStorage() "*Texture::setStorage()" calls.
* @requires_gles20 Not available in ES 3.0 or desktop OpenGL. Use * @requires_gles20 Not available in OpenGL ES 3.0, WebGL 2.0 or desktop
* @ref TextureFormat::RG8 instead. * OpenGL. Use @ref TextureFormat::RG8 instead.
* @deprecated_gl Included for compatibility reasons only, use * @deprecated_gl Included for compatibility reasons only, use
* @ref TextureFormat::RG8 instead. * @ref TextureFormat::RG8 instead.
*/ */
@ -530,20 +620,20 @@ enum class TextureFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGB, normalized unsigned, red and green component 3bit, blue 2bit. * RGB, normalized unsigned, red and green component 3bit, blue 2bit.
* @requires_gl Packed 8bit types are not available in OpenGL ES. * @requires_gl Packed 8bit types are not available in OpenGL ES or WebGL.
*/ */
R3B3G2 = GL_R3_G3_B2, R3B3G2 = GL_R3_G3_B2,
/** /**
* RGB, each component normalized unsigned 4bit. * RGB, each component normalized unsigned 4bit.
* @requires_gl Packed 12bit types are not available in OpenGL ES. * @requires_gl Packed 12bit types are not available in OpenGL ES or WebGL.
*/ */
RGB4 = GL_RGB4, RGB4 = GL_RGB4,
/** /**
* RGB, each component normalized unsigned 5bit. * RGB, each component normalized unsigned 5bit.
* @requires_gl Use @ref TextureFormat::RGB5A1 or @ref TextureFormat::RGB565 * @requires_gl Use @ref TextureFormat::RGB5A1 or @ref TextureFormat::RGB565
* in OpenGL ES. * in OpenGL ES or WebGL.
*/ */
RGB5 = GL_RGB5, RGB5 = GL_RGB5,
#endif #endif
@ -552,11 +642,13 @@ enum class TextureFormat: GLenum {
* RGB, normalized unsigned, red and blue component 5bit, green 6bit. * RGB, normalized unsigned, red and blue component 5bit, green 6bit.
* @requires_gles30 Extension @es_extension{OES,required_internalformat} * @requires_gles30 Extension @es_extension{OES,required_internalformat}
* (for image specification) or @es_extension{EXT,texture_storage} * (for image specification) or @es_extension{EXT,texture_storage}
* (for texture storage) in OpenGL ES 2.0 * (for texture storage) in OpenGL ES 2.0.
* @requires_webgl20 Not available in WebGL 1.0, see @ref TextureFormat::RGB
* for an alternative.
*/ */
RGB565 = GL_RGB565, RGB565 = GL_RGB565,
#ifndef MAGNUM_TARGET_GLES3 #if !defined(MAGNUM_TARGET_GLES3) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* RGB, each component normalized unsigned 10bit. * RGB, each component normalized unsigned 10bit.
* @requires_es_extension Extension @es_extension{EXT,texture_type_2_10_10_10_REV} * @requires_es_extension Extension @es_extension{EXT,texture_type_2_10_10_10_REV}
@ -564,6 +656,8 @@ enum class TextureFormat: GLenum {
* specification) or @es_extension{EXT,texture_storage} (for texture * specification) or @es_extension{EXT,texture_storage} (for texture
* storage) in OpenGL ES 2.0. Included for compatibility reasons only, * storage) in OpenGL ES 2.0. Included for compatibility reasons only,
* use @ref TextureFormat::RGB10A2 in OpenGL ES 3.0 instead. * use @ref TextureFormat::RGB10A2 in OpenGL ES 3.0 instead.
* @requires_gles Not available in WebGL, use @ref TextureFormat::RGB10A2
* instead.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
RGB10 = GL_RGB10, RGB10 = GL_RGB10,
@ -575,7 +669,7 @@ enum class TextureFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGB, each component normalized unsigned 12bit. * RGB, each component normalized unsigned 12bit.
* @requires_gl Packed 36bit types are not available in OpenGL ES. * @requires_gl Packed 36bit types are not available in OpenGL ES or WebGL.
*/ */
RGB12 = GL_RGB12, RGB12 = GL_RGB12,
#endif #endif
@ -586,6 +680,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{EXT,packed_float} * @requires_gl30 Extension @extension{EXT,packed_float}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
R11FG11FB10F = GL_R11F_G11F_B10F, R11FG11FB10F = GL_R11F_G11F_B10F,
@ -593,6 +689,7 @@ enum class TextureFormat: GLenum {
* RGB, unsigned with exponent, each RGB component 9bit, exponent 5bit. * RGB, unsigned with exponent, each RGB component 9bit, exponent 5bit.
* @requires_gl30 Extension @extension{EXT,texture_shared_exponent} * @requires_gl30 Extension @extension{EXT,texture_shared_exponent}
* @requires_gles30 Use @ref TextureFormat::RGB in OpenGL ES 2.0 instead. * @requires_gles30 Use @ref TextureFormat::RGB in OpenGL ES 2.0 instead.
* @requires_webgl20 Use @ref TextureFormat::RGB in WebGL 1.0 instead.
*/ */
RGB9E5 = GL_RGB9_E5, RGB9E5 = GL_RGB9_E5,
#endif #endif
@ -602,6 +699,7 @@ enum class TextureFormat: GLenum {
* unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls, in * unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls, in
* that case use @ref TextureFormat::SRGB8 "TextureFormat::SRGB8" instead. * that case use @ref TextureFormat::SRGB8 "TextureFormat::SRGB8" instead.
* @requires_es_extension Extension @es_extension{EXT,sRGB} * @requires_es_extension Extension @es_extension{EXT,sRGB}
* @requires_webgl_extension Extension @webgl_extension{EXT,sRGB}
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, i.e. @ref TextureFormat::SRGB8. * format, i.e. @ref TextureFormat::SRGB8.
* @todo is this allowed in core? * @todo is this allowed in core?
@ -616,6 +714,7 @@ enum class TextureFormat: GLenum {
/** /**
* sRGB, each component normalized unsigned byte. * sRGB, each component normalized unsigned byte.
* @requires_gles30 Use @ref TextureFormat::SRGB in OpenGL ES 2.0 instead. * @requires_gles30 Use @ref TextureFormat::SRGB in OpenGL ES 2.0 instead.
* @requires_webgl20 Use @ref TextureFormat::SRGB in WebGL 1.0 instead.
*/ */
SRGB8 = GL_SRGB8, SRGB8 = GL_SRGB8,
#endif #endif
@ -623,7 +722,7 @@ enum class TextureFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGBA, normalized unsigned, each component 2bit. * RGBA, normalized unsigned, each component 2bit.
* @requires_gl Packed 8bit types are not available in OpenGL ES. * @requires_gl Packed 8bit types are not available in OpenGL ES or WebGL.
*/ */
RGBA2 = GL_RGBA2, RGBA2 = GL_RGBA2,
#endif #endif
@ -632,7 +731,10 @@ enum class TextureFormat: GLenum {
* RGBA, normalized unsigned, each component 4bit. * RGBA, normalized unsigned, each component 4bit.
* @requires_gles30 Extension @es_extension{OES,required_internalformat} * @requires_gles30 Extension @es_extension{OES,required_internalformat}
* (for image specification) or @es_extension{EXT,texture_storage} * (for image specification) or @es_extension{EXT,texture_storage}
* (for texture storage) in OpenGL ES 2.0 * (for texture storage) in OpenGL ES 2.0. Use @ref TextureFormat::RGBA
* otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use @ref TextureFormat::RGBA
* instead.
*/ */
RGBA4 = GL_RGBA4, RGBA4 = GL_RGBA4,
@ -640,22 +742,28 @@ enum class TextureFormat: GLenum {
* RGBA, normalized unsigned, each RGB component 5bit, alpha 1bit. * RGBA, normalized unsigned, each RGB component 5bit, alpha 1bit.
* @requires_gles30 Extension @es_extension{OES,required_internalformat} * @requires_gles30 Extension @es_extension{OES,required_internalformat}
* (for image specification) or @es_extension{EXT,texture_storage} * (for image specification) or @es_extension{EXT,texture_storage}
* (for texture storage) in OpenGL ES 2.0 * (for texture storage) in OpenGL ES 2.0. Use @ref TextureFormat::RGBA
* otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use @ref TextureFormat::RGBA
* instead.
*/ */
RGB5A1 = GL_RGB5_A1, RGB5A1 = GL_RGB5_A1,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* RGBA, normalized unsigned, each RGB component 10bit, alpha 2bit. * RGBA, normalized unsigned, each RGB component 10bit, alpha 2bit.
* @requires_gles30 Extension @es_extension{EXT,texture_type_2_10_10_10_REV} * @requires_gles30 Extension @es_extension{EXT,texture_type_2_10_10_10_REV}
* and either @es_extension{OES,required_internalformat} (for image * and either @es_extension{OES,required_internalformat} (for image
* specification) or @es_extension{EXT,texture_storage} (for texture * specification) or @es_extension{EXT,texture_storage} (for texture
* storage) in OpenGL ES 2.0 * storage) in OpenGL ES 2.0.
* @requires_webgl20 Not available in WebGL 1.0.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
RGB10A2 = GL_RGB10_A2, RGB10A2 = GL_RGB10_A2,
#else #else
RGB10A2 = GL_RGB10_A2_EXT, RGB10A2 = GL_RGB10_A2_EXT,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -663,6 +771,8 @@ enum class TextureFormat: GLenum {
* @requires_gl33 Extension @extension{ARB,texture_rgb10_a2ui} * @requires_gl33 Extension @extension{ARB,texture_rgb10_a2ui}
* @requires_gles30 Only normalized integral formats are available in * @requires_gles30 Only normalized integral formats are available in
* OpenGL ES 2.0. * OpenGL ES 2.0.
* @requires_webgl20 Only normalized integral formats are available in
* WebGL 1.0.
*/ */
RGB10A2UI = GL_RGB10_A2UI, RGB10A2UI = GL_RGB10_A2UI,
#endif #endif
@ -670,7 +780,7 @@ enum class TextureFormat: GLenum {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* RGBA, each component normalized unsigned 12bit. * RGBA, each component normalized unsigned 12bit.
* @requires_gl Packed 48bit types are not available in OpenGL ES. * @requires_gl Packed 48bit types are not available in OpenGL ES or WebGL.
*/ */
RGBA12 = GL_RGBA12, RGBA12 = GL_RGBA12,
#endif #endif
@ -680,6 +790,7 @@ enum class TextureFormat: GLenum {
* unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls, in * unemulated @ref Texture::setStorage() "*Texture::setStorage()" calls, in
* that case use @ref TextureFormat::SRGB8Alpha8 "TextureFormat::SRGB8Alpha8" instead. * that case use @ref TextureFormat::SRGB8Alpha8 "TextureFormat::SRGB8Alpha8" instead.
* @requires_es_extension Extension @es_extension{EXT,sRGB} * @requires_es_extension Extension @es_extension{EXT,sRGB}
* @requires_webgl_extension Extension @webgl_extension{EXT,sRGB}
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, i.e. @ref TextureFormat::SRGB8Alpha8. * format, i.e. @ref TextureFormat::SRGB8Alpha8.
* @todo is this allowed in core? * @todo is this allowed in core?
@ -695,6 +806,8 @@ enum class TextureFormat: GLenum {
* sRGBA, each component normalized unsigned byte. * sRGBA, each component normalized unsigned byte.
* @requires_gles30 Use @ref TextureFormat::SRGBAlpha in OpenGL ES 2.0 * @requires_gles30 Use @ref TextureFormat::SRGBAlpha in OpenGL ES 2.0
* instead. * instead.
* @requires_webgl20 Use @ref TextureFormat::SRGBAlpha in WebGL 1.0
* instead.
*/ */
SRGB8Alpha8 = GL_SRGB8_ALPHA8, SRGB8Alpha8 = GL_SRGB8_ALPHA8,
#endif #endif
@ -704,7 +817,8 @@ enum class TextureFormat: GLenum {
* Compressed red channel, normalized unsigned. **Not available on * Compressed red channel, normalized unsigned. **Not available on
* multisample textures.** * multisample textures.**
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Generic texture compression is not available in OpenGL ES. * @requires_gl Generic texture compression is not available in OpenGL ES
* or WebGL.
*/ */
CompressedRed = GL_COMPRESSED_RED, CompressedRed = GL_COMPRESSED_RED,
@ -712,21 +826,24 @@ enum class TextureFormat: GLenum {
* Compressed red and green channel, normalized unsigned. **Not available * Compressed red and green channel, normalized unsigned. **Not available
* on multisample textures.** * on multisample textures.**
* @requires_gl30 Extension @extension{ARB,texture_rg} * @requires_gl30 Extension @extension{ARB,texture_rg}
* @requires_gl Generic texture compression is not available in OpenGL ES. * @requires_gl Generic texture compression is not available in OpenGL ES
* or WebGL.
*/ */
CompressedRG = GL_COMPRESSED_RG, CompressedRG = GL_COMPRESSED_RG,
/** /**
* Compressed RGB, normalized unsigned. **Not available on multisample * Compressed RGB, normalized unsigned. **Not available on multisample
* textures.** * textures.**
* @requires_gl Generic texture compression is not available in OpenGL ES. * @requires_gl Generic texture compression is not available in OpenGL ES
* or WebGL.
*/ */
CompressedRGB = GL_COMPRESSED_RGB, CompressedRGB = GL_COMPRESSED_RGB,
/** /**
* Compressed RGBA, normalized unsigned. **Not available on multisample * Compressed RGBA, normalized unsigned. **Not available on multisample
* textures.** * textures.**
* @requires_gl Generic texture compression is not available in OpenGL ES. * @requires_gl Generic texture compression is not available in OpenGL ES
* or WebGL.
*/ */
CompressedRGBA = GL_COMPRESSED_RGBA, CompressedRGBA = GL_COMPRESSED_RGBA,
@ -734,7 +851,8 @@ enum class TextureFormat: GLenum {
* RGTC compressed red channel, normalized unsigned. **Not available on * RGTC compressed red channel, normalized unsigned. **Not available on
* multisample textures.** * multisample textures.**
* @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc}
* @requires_gl RGTC texture compression is not available in OpenGL ES. * @requires_gl Generic texture compression is not available in OpenGL ES
* or WebGL.
*/ */
CompressedRedRgtc1 = GL_COMPRESSED_RED_RGTC1, CompressedRedRgtc1 = GL_COMPRESSED_RED_RGTC1,
@ -742,7 +860,8 @@ enum class TextureFormat: GLenum {
* RGTC compressed red and green channel, normalized unsigned. **Not * RGTC compressed red and green channel, normalized unsigned. **Not
* available on multisample textures.** * available on multisample textures.**
* @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc}
* @requires_gl RGTC texture compression is not available in OpenGL ES. * @requires_gl RGTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedRGRgtc2 = GL_COMPRESSED_RG_RGTC2, CompressedRGRgtc2 = GL_COMPRESSED_RG_RGTC2,
@ -750,7 +869,8 @@ enum class TextureFormat: GLenum {
* RGTC compressed red channel, normalized signed. **Not available on * RGTC compressed red channel, normalized signed. **Not available on
* multisample textures.** * multisample textures.**
* @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc}
* @requires_gl RGTC texture compression is not available in OpenGL ES. * @requires_gl RGTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedSignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1, CompressedSignedRedRgtc1 = GL_COMPRESSED_SIGNED_RED_RGTC1,
@ -758,7 +878,8 @@ enum class TextureFormat: GLenum {
* RGTC compressed red and green channel, normalized signed. **Not * RGTC compressed red and green channel, normalized signed. **Not
* available on multisample textures.** * available on multisample textures.**
* @requires_gl30 Extension @extension{EXT,texture_compression_rgtc} * @requires_gl30 Extension @extension{EXT,texture_compression_rgtc}
* @requires_gl RGTC texture compression is not available in OpenGL ES. * @requires_gl RGTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedSignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2, CompressedSignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2,
@ -766,7 +887,8 @@ enum class TextureFormat: GLenum {
* BPTC compressed RGB, unsigned float. **Not available on multisample * BPTC compressed RGB, unsigned float. **Not available on multisample
* textures.** * textures.**
* @requires_gl42 Extension @extension{ARB,texture_compression_bptc} * @requires_gl42 Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES. * @requires_gl BPTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
@ -774,7 +896,8 @@ enum class TextureFormat: GLenum {
* BPTC compressed RGB, signed float. **Not available on multisample * BPTC compressed RGB, signed float. **Not available on multisample
* textures.** * textures.**
* @requires_gl42 Extension @extension{ARB,texture_compression_bptc} * @requires_gl42 Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES. * @requires_gl BPTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT,
@ -782,7 +905,8 @@ enum class TextureFormat: GLenum {
* BPTC compressed RGBA, normalized unsigned. **Not available on * BPTC compressed RGBA, normalized unsigned. **Not available on
* multisample textures.** * multisample textures.**
* @requires_gl42 Extension @extension{ARB,texture_compression_bptc} * @requires_gl42 Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES. * @requires_gl BPTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM,
@ -790,7 +914,8 @@ enum class TextureFormat: GLenum {
* BPTC compressed sRGBA, normalized unsigned. **Not available on * BPTC compressed sRGBA, normalized unsigned. **Not available on
* multisample textures.** * multisample textures.**
* @requires_gl42 Extension @extension{ARB,texture_compression_bptc} * @requires_gl42 Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES. * @requires_gl BPTC texture compression is not available in OpenGL ES or
* WebGL.
*/ */
CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
#endif #endif
@ -801,19 +926,25 @@ enum class TextureFormat: GLenum {
* "*Texture::setStorage()" calls, in that case use e.g. * "*Texture::setStorage()" calls, in that case use e.g.
* @ref TextureFormat::DepthComponent24 "TextureFormat::DepthComponent24" instead. * @ref TextureFormat::DepthComponent24 "TextureFormat::DepthComponent24" instead.
* @requires_gles30 Extension @es_extension{OES,depth_texture} or * @requires_gles30 Extension @es_extension{OES,depth_texture} or
* @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0 * @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0.
* @requires_webgl20 Extension @webgl_extension{WEBGL,depth_texture} in
* WebGL 1.0.
* @deprecated_gl Prefer to use the exactly specified version of this * @deprecated_gl Prefer to use the exactly specified version of this
* format, e.g. @ref TextureFormat::DepthComponent24. * format, e.g. @ref TextureFormat::DepthComponent24.
*/ */
DepthComponent = GL_DEPTH_COMPONENT, DepthComponent = GL_DEPTH_COMPONENT,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* Depth component, 16bit. Not supported in 3D textures. * Depth component, 16bit. Not supported in 3D textures.
* @requires_gles30 Extension @es_extension{OES,depth_texture} or * @requires_gles30 Extension @es_extension{OES,depth_texture} or
* @es_extension{ANGLE,depth_texture} and either * @es_extension{ANGLE,depth_texture} and either
* @es_extension{OES,required_internalformat} (for image * @es_extension{OES,required_internalformat} (for image
* specification) or @es_extension{EXT,texture_storage} (for texture * specification) or @es_extension{EXT,texture_storage} (for texture
* storage) in OpenGL ES 2.0 * storage) in OpenGL ES 2.0. Use @ref TextureFormat::DepthComponent
* otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use
* @ref TextureFormat::DepthComponent instead.
*/ */
DepthComponent16 = GL_DEPTH_COMPONENT16, DepthComponent16 = GL_DEPTH_COMPONENT16,
@ -821,27 +952,33 @@ enum class TextureFormat: GLenum {
* Depth component, 24bit. Not supported in 3D textures. * Depth component, 24bit. Not supported in 3D textures.
* @requires_gles30 Extension @es_extension{OES,required_internalformat}, * @requires_gles30 Extension @es_extension{OES,required_internalformat},
* @es_extension{OES,depth_texture} and @es_extension{OES,depth24} in * @es_extension{OES,depth_texture} and @es_extension{OES,depth24} in
* OpenGL ES 2.0 * OpenGL ES 2.0. Use @ref TextureFormat::DepthComponent otherwise.
* @requires_webgl20 Not available in WebGL 1.0, use
* @ref TextureFormat::DepthComponent instead.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
DepthComponent24 = GL_DEPTH_COMPONENT24, DepthComponent24 = GL_DEPTH_COMPONENT24,
#else #else
DepthComponent24 = GL_DEPTH_COMPONENT24_OES, DepthComponent24 = GL_DEPTH_COMPONENT24_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* Depth component, 32bit. Not supported in 3D textures. * Depth component, 32bit. Not supported in 3D textures.
* @requires_es_extension Extension @es_extension{OES,depth_texture} or * @requires_es_extension Extension @es_extension{OES,depth_texture} or
* @es_extension{ANGLE,depth_texture} and @es_extension{OES,depth32} * @es_extension{ANGLE,depth_texture} and @es_extension{OES,depth32}
* and @es_extension{OES,required_internalformat} (for image * and @es_extension{OES,required_internalformat} (for image
* specification) or @es_extension{EXT,texture_storage} (for texture * specification) or @es_extension{EXT,texture_storage} (for texture
* storage) in OpenGL ES 2.0 * storage) in OpenGL ES 2.0.
* @requires_gles Not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
DepthComponent32 = GL_DEPTH_COMPONENT32, DepthComponent32 = GL_DEPTH_COMPONENT32,
#else #else
DepthComponent32 = GL_DEPTH_COMPONENT32_OES, DepthComponent32 = GL_DEPTH_COMPONENT32_OES,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -849,6 +986,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,depth_buffer_float} * @requires_gl30 Extension @extension{ARB,depth_buffer_float}
* @requires_gles30 Only integral depth textures are available in OpenGL ES * @requires_gles30 Only integral depth textures are available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Only integral depth textures are available in WebGL
* 1.0.
*/ */
DepthComponent32F = GL_DEPTH_COMPONENT32F, DepthComponent32F = GL_DEPTH_COMPONENT32F,
#endif #endif
@ -857,7 +996,8 @@ enum class TextureFormat: GLenum {
/** /**
* Stencil index, 8bit. Not supported in 3D textures. * Stencil index, 8bit. Not supported in 3D textures.
* @requires_gl44 Extension @extension{ARB,texture_stencil8} * @requires_gl44 Extension @extension{ARB,texture_stencil8}
* @requires_gl Only available as renderbuffer format in OpenGL ES. * @requires_gl Only available as renderbuffer format in OpenGL ES and
* WebGL.
*/ */
StencilIndex8 = GL_STENCIL_INDEX8, StencilIndex8 = GL_STENCIL_INDEX8,
#endif #endif
@ -870,16 +1010,21 @@ enum class TextureFormat: GLenum {
* instead. * instead.
* @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" * @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()"
* @requires_gles30 Extension @es_extension{OES,packed_depth_stencil} or * @requires_gles30 Extension @es_extension{OES,packed_depth_stencil} or
* @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0 * @es_extension{ANGLE,depth_texture} in OpenGL ES 2.0.
* @requires_webgl20 Extension @webgl_extension{WEBGL,depth_texture} in
* WebGL 1.0.
* @deprecated_gl Prefer to use exactly specified version of this format, * @deprecated_gl Prefer to use exactly specified version of this format,
* e.g. @ref TextureFormat::Depth24Stencil8. * e.g. @ref TextureFormat::Depth24Stencil8.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
DepthStencil = GL_DEPTH_STENCIL, DepthStencil = GL_DEPTH_STENCIL,
#else #else
/* Using OES version even though WebGL 1.0 *has* DEPTH_STENCIL constant,
because there are no such headers for it */
DepthStencil = GL_DEPTH_STENCIL_OES, DepthStencil = GL_DEPTH_STENCIL_OES,
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* 24bit depth and 8bit stencil component. Not supported in 3D textures. * 24bit depth and 8bit stencil component. Not supported in 3D textures.
* @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" * @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()"
@ -888,13 +1033,16 @@ enum class TextureFormat: GLenum {
* @es_extension{ANGLE,depth_texture} and either * @es_extension{ANGLE,depth_texture} and either
* @es_extension{OES,required_internalformat} (for image * @es_extension{OES,required_internalformat} (for image
* specification) or @es_extension{EXT,texture_storage} (for texture * specification) or @es_extension{EXT,texture_storage} (for texture
* storage) in OpenGL ES 2.0 * storage) in OpenGL ES 2.0.
* @requires_webgl20 Use @ref TextureFormat::DepthStencil in WebGL 1.0
* instead.
*/ */
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
Depth24Stencil8 = GL_DEPTH24_STENCIL8_OES Depth24Stencil8 = GL_DEPTH24_STENCIL8_OES
#else #else
Depth24Stencil8 = GL_DEPTH24_STENCIL8, Depth24Stencil8 = GL_DEPTH24_STENCIL8,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@ -904,6 +1052,8 @@ enum class TextureFormat: GLenum {
* @requires_gl30 Extension @extension{ARB,depth_buffer_float} * @requires_gl30 Extension @extension{ARB,depth_buffer_float}
* @requires_gles30 Only integral depth textures are available in OpenGL ES * @requires_gles30 Only integral depth textures are available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Only integral depth textures are available in WebGL
* 1.0.
*/ */
Depth32FStencil8 = GL_DEPTH32F_STENCIL8 Depth32FStencil8 = GL_DEPTH32F_STENCIL8
#endif #endif

26
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp

@ -47,8 +47,14 @@ auto TgaImageConverter::doFeatures() const -> Features { return Feature::Convert
Containers::Array<char> TgaImageConverter::doExportToData(const ImageReference2D& image) const { Containers::Array<char> TgaImageConverter::doExportToData(const ImageReference2D& image) const {
if(image.format() != ColorFormat::RGB && if(image.format() != ColorFormat::RGB &&
image.format() != ColorFormat::RGBA && image.format() != ColorFormat::RGBA
image.format() != ColorFormat::Red) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&& image.format() != ColorFormat::Red
#endif
#ifdef MAGNUM_TARGET_GLES2
&& image.format() != ColorFormat::Luminance
#endif
)
{ {
Error() << "Trade::TgaImageConverter::exportToData(): unsupported color format" << image.format(); Error() << "Trade::TgaImageConverter::exportToData(): unsupported color format" << image.format();
return nullptr; return nullptr;
@ -65,7 +71,21 @@ Containers::Array<char> TgaImageConverter::doExportToData(const ImageReference2D
/* Fill header */ /* Fill header */
auto header = reinterpret_cast<TgaHeader*>(data.begin()); auto header = reinterpret_cast<TgaHeader*>(data.begin());
header->imageType = image.format() == ColorFormat::Red ? 3 : 2; switch(image.format()) {
case ColorFormat::RGB:
case ColorFormat::RGBA:
header->imageType = 2;
break;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
case ColorFormat::Red:
#endif
#ifdef MAGNUM_TARGET_GLES2
case ColorFormat::Luminance:
#endif
header->imageType = 3;
break;
default: CORRADE_ASSERT_UNREACHABLE();
}
header->bpp = pixelSize*8; header->bpp = pixelSize*8;
header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x())); header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x()));
header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y())); header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y()));

3
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h

@ -52,7 +52,8 @@ namespace Magnum { namespace Trade {
@brief TGA image converter plugin @brief TGA image converter plugin
Supports images with format @ref ColorFormat::RGB, @ref ColorFormat::RGBA or Supports images with format @ref ColorFormat::RGB, @ref ColorFormat::RGBA or
@ref ColorFormat::Red and type @ref ColorType::UnsignedByte. @ref ColorFormat::Red (or @ref ColorFormat::Luminance in OpenGL ES 2.0) and
type @ref ColorType::UnsignedByte.
This plugin is built if `WITH_TGAIMAGECONVERTER` is enabled when building This plugin is built if `WITH_TGAIMAGECONVERTER` is enabled when building
Magnum. To use dynamic plugin, you need to load `TgaImageConverter` plugin Magnum. To use dynamic plugin, you need to load `TgaImageConverter` plugin

6
src/MagnumPlugins/TgaImporter/TgaImporter.cpp

@ -113,11 +113,13 @@ std::optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt) {
/* Grayscale */ /* Grayscale */
} else if(header.imageType == 3) { } else if(header.imageType == 3) {
#ifdef MAGNUM_TARGET_GLES2 #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
format = Context::current() && Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>() ? format = Context::current() && Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_rg>() ?
ColorFormat::Red : ColorFormat::Luminance; ColorFormat::Red : ColorFormat::Luminance;
#else #elif !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
format = ColorFormat::Red; format = ColorFormat::Red;
#else
format = ColorFormat::Luminance;
#endif #endif
if(header.bpp != 8) { if(header.bpp != 8) {
Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp;

Loading…
Cancel
Save