Browse Source

First-class WebGL support, part 4: reduced texture functionality.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
cb16c932a4
  1. 46
      src/Magnum/AbstractTexture.cpp
  2. 92
      src/Magnum/AbstractTexture.h
  3. 10
      src/Magnum/BufferTexture.h
  4. 11
      src/Magnum/CMakeLists.txt
  5. 4
      src/Magnum/CubeMapTexture.cpp
  6. 100
      src/Magnum/CubeMapTexture.h
  7. 4
      src/Magnum/CubeMapTextureArray.h
  8. 27
      src/Magnum/Implementation/TextureState.cpp
  9. 12
      src/Magnum/Implementation/TextureState.h
  10. 2
      src/Magnum/Implementation/maxTextureSize.cpp
  11. 2
      src/Magnum/Implementation/maxTextureSize.h
  12. 26
      src/Magnum/MultisampleTexture.h
  13. 4
      src/Magnum/RectangleTexture.h
  14. 4
      src/Magnum/Sampler.cpp
  15. 35
      src/Magnum/Sampler.h
  16. 2
      src/Magnum/Texture.cpp
  17. 235
      src/Magnum/Texture.h
  18. 55
      src/Magnum/TextureArray.h

46
src/Magnum/AbstractTexture.cpp

@ -65,7 +65,7 @@ Float AbstractTexture::maxLodBias() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int AbstractTexture::maxColorSamples() { Int AbstractTexture::maxColorSamples() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
@ -302,6 +302,7 @@ void AbstractTexture::setBaseLevel(Int level) {
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::setMaxLevel(Int level) { void AbstractTexture::setMaxLevel(Int level) {
(this->*Context::current()->state().texture->parameteriImplementation)( (this->*Context::current()->state().texture->parameteriImplementation)(
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -311,6 +312,7 @@ void AbstractTexture::setMaxLevel(Int level) {
#endif #endif
, level); , level);
} }
#endif
void AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) { void AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_MIN_FILTER, GLint(filter)|GLint(mipmap)); (this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_MIN_FILTER, GLint(filter)|GLint(mipmap));
@ -336,6 +338,7 @@ void AbstractTexture::setLodBias(const Float bias) {
} }
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::setBorderColor(const Color4& color) { void AbstractTexture::setBorderColor(const Color4& color) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
(this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); (this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data());
@ -343,6 +346,7 @@ void AbstractTexture::setBorderColor(const Color4& color) {
(this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR_NV, color.data()); (this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR_NV, color.data());
#endif #endif
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::setBorderColor(const Vector4ui& color) { void AbstractTexture::setBorderColor(const Vector4ui& color) {
@ -358,12 +362,14 @@ void AbstractTexture::setMaxAnisotropy(const Float anisotropy) {
(this->*Context::current()->state().texture->setMaxAnisotropyImplementation)(anisotropy); (this->*Context::current()->state().texture->setMaxAnisotropyImplementation)(anisotropy);
} }
#ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::setSRGBDecode(bool decode) { void AbstractTexture::setSRGBDecode(bool decode) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SRGB_DECODE_EXT, (this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SRGB_DECODE_EXT,
decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT); decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT);
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::setSwizzleInternal(const GLint r, const GLint g, const GLint b, const GLint a) { void AbstractTexture::setSwizzleInternal(const GLint r, const GLint g, const GLint b, const GLint a) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const GLint rgba[] = {r, g, b, a}; const GLint rgba[] = {r, g, b, a};
@ -377,6 +383,7 @@ void AbstractTexture::setSwizzleInternal(const GLint r, const GLint g, const GLi
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::setCompareMode(const Sampler::CompareMode mode) { void AbstractTexture::setCompareMode(const Sampler::CompareMode mode) {
(this->*Context::current()->state().texture->parameteriImplementation)( (this->*Context::current()->state().texture->parameteriImplementation)(
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -396,8 +403,9 @@ void AbstractTexture::setCompareFunction(const Sampler::CompareFunction function
#endif #endif
, GLenum(function)); , GLenum(function));
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::setDepthStencilMode(const Sampler::DepthStencilMode mode) { void AbstractTexture::setDepthStencilMode(const Sampler::DepthStencilMode mode) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode)); (this->*Context::current()->state().texture->parameteriImplementation)(GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode));
} }
@ -926,7 +934,7 @@ void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); (this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
} }
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values) { void AbstractTexture::getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values) {
bindInternal(); bindInternal();
glGetTexLevelParameteriv(_target, level, parameter, values); glGetTexLevelParameteriv(_target, level, parameter, values);
@ -969,6 +977,7 @@ void AbstractTexture::storageImplementationDSAEXT(GLsizei levels, TextureFormat
} }
#endif #endif
#if !defined(MAGNUM_TARGET_WEBGL) || defined(MAGNUM_TARGET_GLES2)
void AbstractTexture::storageImplementationFallback(const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { void AbstractTexture::storageImplementationFallback(const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) {
const ColorFormat format = imageFormatForInternalFormat(internalFormat); const ColorFormat format = imageFormatForInternalFormat(internalFormat);
const ColorType type = imageTypeForInternalFormat(internalFormat); const ColorType type = imageTypeForInternalFormat(internalFormat);
@ -1008,12 +1017,14 @@ void AbstractTexture::storageImplementationFallback(const GLsizei levels, const
/* No other targets are available */ /* No other targets are available */
} else CORRADE_ASSERT_UNREACHABLE(); } else CORRADE_ASSERT_UNREACHABLE();
} }
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector2i& size) { void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector2i& size) {
bindInternal(); bindInternal();
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
glTexStorage2D(_target, levels, GLenum(internalFormat), size.x(), size.y()); glTexStorage2D(_target, levels, GLenum(internalFormat), size.x(), size.y());
#elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
glTexStorage2DEXT(_target, levels, GLenum(internalFormat), size.x(), size.y()); glTexStorage2DEXT(_target, levels, GLenum(internalFormat), size.x(), size.y());
#else #else
static_cast<void>(levels); static_cast<void>(levels);
@ -1022,6 +1033,7 @@ void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
#endif #endif
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::storageImplementationDSA(const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { void AbstractTexture::storageImplementationDSA(const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) {
@ -1034,6 +1046,7 @@ void AbstractTexture::storageImplementationDSAEXT(GLsizei levels, TextureFormat
} }
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size) { void AbstractTexture::storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size) {
const ColorFormat format = imageFormatForInternalFormat(internalFormat); const ColorFormat format = imageFormatForInternalFormat(internalFormat);
const ColorType type = imageTypeForInternalFormat(internalFormat); const ColorType type = imageTypeForInternalFormat(internalFormat);
@ -1063,12 +1076,14 @@ void AbstractTexture::storageImplementationFallback(GLsizei levels, TextureForma
/* No other targets are available */ /* No other targets are available */
else CORRADE_ASSERT_UNREACHABLE(); else CORRADE_ASSERT_UNREACHABLE();
} }
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector3i& size) { void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector3i& size) {
bindInternal(); bindInternal();
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
glTexStorage3D(_target, levels, GLenum(internalFormat), size.x(), size.y(), size.z()); glTexStorage3D(_target, levels, GLenum(internalFormat), size.x(), size.y(), size.z());
#elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
glTexStorage3DEXT(_target, levels, GLenum(internalFormat), size.x(), size.y(), size.z()); glTexStorage3DEXT(_target, levels, GLenum(internalFormat), size.x(), size.y(), size.z());
#else #else
static_cast<void>(levels); static_cast<void>(levels);
@ -1077,6 +1092,7 @@ void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
#endif #endif
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::storageImplementationDSA(const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) { void AbstractTexture::storageImplementationDSA(const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) {
@ -1096,7 +1112,7 @@ void AbstractTexture::storageMultisampleImplementationFallback(const GLsizei sam
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::storageMultisampleImplementationDefault(const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) { void AbstractTexture::storageMultisampleImplementationDefault(const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
bindInternal(); bindInternal();
glTexStorage2DMultisample(_target, samples, GLenum(internalFormat), size.x(), size.y(), fixedSampleLocations); glTexStorage2DMultisample(_target, samples, GLenum(internalFormat), size.x(), size.y(), fixedSampleLocations);
@ -1186,11 +1202,12 @@ void AbstractTexture::subImageImplementationDSAEXT(GLint level, const Vector2i&
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) { void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal(); bindInternal();
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
glTexSubImage3D(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); glTexSubImage3D(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
#elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
glTexSubImage3DOES(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); glTexSubImage3DOES(_target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
#else #else
static_cast<void>(level); static_cast<void>(level);
@ -1202,6 +1219,7 @@ void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i&
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
#endif #endif
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) { void AbstractTexture::subImageImplementationDSA(const GLint level, const Vector3i& offset, const Vector3i& size, const ColorFormat format, const ColorType type, const GLvoid* const data) {
@ -1308,7 +1326,7 @@ Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLint level) { Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLint level) {
const Implementation::TextureState& state = *Context::current()->state().texture; const Implementation::TextureState& state = *Context::current()->state().texture;
@ -1339,11 +1357,13 @@ void AbstractTexture::DataHelper<2>::setStorage(AbstractTexture& texture, const
(texture.*Context::current()->state().texture->storage2DImplementation)(levels, internalFormat, size); (texture.*Context::current()->state().texture->storage2DImplementation)(levels, internalFormat, size);
} }
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) { void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) {
(texture.*Context::current()->state().texture->storage3DImplementation)(levels, internalFormat, size); (texture.*Context::current()->state().texture->storage3DImplementation)(levels, internalFormat, size);
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::DataHelper<2>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) { void AbstractTexture::DataHelper<2>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
(texture.*Context::current()->state().texture->storage2DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations); (texture.*Context::current()->state().texture->storage2DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations);
} }
@ -1409,6 +1429,7 @@ void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLint level, const TextureFormat internalFormat, const ImageReference3D& image) { void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLint level, const TextureFormat internalFormat, const ImageReference3D& image) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
@ -1416,7 +1437,7 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GL
texture.bindInternal(); texture.bindInternal();
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
glTexImage3D(texture._target, level, GLint(internalFormat), image.size().x(), image.size().y(), image.size().z(), 0, GLenum(image.format()), GLenum(image.type()), image.data()); glTexImage3D(texture._target, level, GLint(internalFormat), image.size().x(), image.size().y(), image.size().z(), 0, GLenum(image.format()), GLenum(image.type()), image.data());
#elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
glTexImage3DOES(texture._target, level, GLint(internalFormat), image.size().x(), image.size().y(), image.size().z(), 0, GLenum(image.format()), GLenum(image.type()), image.data()); glTexImage3DOES(texture._target, level, GLint(internalFormat), image.size().x(), image.size().y(), image.size().z(), 0, GLenum(image.format()), GLenum(image.type()), image.data());
#else #else
static_cast<void>(level); static_cast<void>(level);
@ -1425,6 +1446,7 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GL
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
#endif #endif
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLint level, const TextureFormat internalFormat, BufferImage3D& image) { void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GLint level, const TextureFormat internalFormat, BufferImage3D& image) {
@ -1434,12 +1456,14 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GL
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, const ImageReference3D& image) { void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, const ImageReference3D& image) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
#endif #endif
(texture.*Context::current()->state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data()); (texture.*Context::current()->state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data());
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, BufferImage3D& image) { void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, BufferImage3D& image) {

92
src/Magnum/AbstractTexture.h

@ -79,16 +79,17 @@ to not affect active bindings in user units. Texture limits and
implementation-defined values (such as @ref maxColorSamples()) are cached, so implementation-defined values (such as @ref maxColorSamples()) are cached, so
repeated queries don't result in repeated @fn_gl{Get} calls. repeated queries don't result in repeated @fn_gl{Get} calls.
If on desktop GL and @extension{ARB,direct_state_access} (part of OpenGL 4.5) If @extension{ARB,direct_state_access} (part of OpenGL 4.5) is available,
is available, @ref bind(Int) and @ref unbind(Int) use @fn_gl{BindTextureUnit}. @ref bind(Int) and @ref unbind(Int) use @fn_gl{BindTextureUnit}. Otherwise, if
Otherwise, if @extension{ARB,multi_bind} (part of OpenGL 4.4) is available, @extension{ARB,multi_bind} (part of OpenGL 4.4) is available, @ref bind(Int)
@ref bind(Int) and @ref unbind() uses @fn_gl{BindTextures}. Lastly, if and @ref unbind() uses @fn_gl{BindTextures}. Lastly, if
@extension{EXT,direct_state_access} is available, @fn_gl_extension{BindNamedTexture,EXT,direct_state_access} @extension{EXT,direct_state_access} desktop extension is available,
function is used to avoid unnecessary calls to @fn_gl{ActiveTexture}. @fn_gl_extension{BindNamedTexture,EXT,direct_state_access} function is used to
avoid unnecessary calls to @fn_gl{ActiveTexture}.
In addition, if either @extension{ARB,direct_state_access} (part of OpenGL 4.5) In addition, if either @extension{ARB,direct_state_access} (part of OpenGL 4.5)
or @extension{EXT,direct_state_access} is available, also all texture or @extension{EXT,direct_state_access} desktop extension is available, also all
configuration and data updating functions use DSA functions to avoid texture configuration and data updating functions use DSA functions to avoid
unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}. See unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}. See
respective function documentation for more information. respective function documentation for more information.
@ -98,12 +99,12 @@ use @fn_gl{BindTextures} to avoid unnecessary calls to @fn_gl{ActiveTexture}.
Otherwise the feature is emulated with sequence of @ref bind(Int)/@ref unbind(Int) Otherwise the feature is emulated with sequence of @ref bind(Int)/@ref unbind(Int)
calls. calls.
If either @extension{ARB,direct_state_access} or @extension{ARB,robustness} is If either @extension{ARB,direct_state_access} (part of OpenGL 4.5) or
available, image reading operations (such as @ref Texture::image()) are @extension{ARB,robustness} desktop extension is available, image reading
protected from buffer overflow. However, if @extension{ARB,direct_state_access} operations (such as @ref Texture::image()) are protected from buffer overflow.
is not available and both @extension{EXT,direct_state_access} and However, if @extension{ARB,direct_state_access} is not available and both
@extension{ARB,robustness} are available, the robust version is preferred over @extension{EXT,direct_state_access} and @extension{ARB,robustness} are
DSA. available, the robust version is preferred over DSA.
To achieve least state changes, fully configure each texture in one run -- To achieve least state changes, fully configure each texture in one run --
method chaining comes in handy -- and try to have often used textures in method chaining comes in handy -- and try to have often used textures in
@ -159,11 +160,13 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_LOD_BIAS} * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_LOD_BIAS}
* @requires_gles30 Texture LOD bias doesn't have * @requires_gles30 Texture LOD bias doesn't have
* implementation-defined range in OpenGL ES 2.0. * implementation-defined range in OpenGL ES 2.0.
* @requires_webgl20 Texture LOD bias doesn't have
* implementation-defined range in WebGL 1.0.
*/ */
static Float maxLodBias(); static Float maxLodBias();
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Max supported color sample count * @brief Max supported color sample count
* *
@ -171,7 +174,8 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* OpenGL calls. If neither extension @extension{ARB,texture_multisample} * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_COLOR_TEXTURE_SAMPLES} * @see @fn_gl{Get} with @def_gl{MAX_COLOR_TEXTURE_SAMPLES}
* @requires_gles30 Not defined in OpenGL ES 2.0 * @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_gles Multisample textures are not available in WebGL.
*/ */
static Int maxColorSamples(); static Int maxColorSamples();
@ -182,7 +186,8 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* OpenGL calls. If neither extension @extension{ARB,texture_multisample} * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_DEPTH_TEXTURE_SAMPLES} * @see @fn_gl{Get} with @def_gl{MAX_DEPTH_TEXTURE_SAMPLES}
* @requires_gles30 Not defined in OpenGL ES 2.0 * @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_gles Multisample textures are not available in WebGL.
*/ */
static Int maxDepthSamples(); static Int maxDepthSamples();
@ -193,7 +198,8 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* OpenGL calls. If neither extension @extension{ARB,texture_multisample} * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_INTEGER_SAMPLES} * @see @fn_gl{Get} with @def_gl{MAX_INTEGER_SAMPLES}
* @requires_gles30 Not defined in OpenGL ES 2.0 * @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_gles Multisample textures are not available in WebGL.
*/ */
static Int maxIntegerSamples(); static Int maxIntegerSamples();
#endif #endif
@ -201,10 +207,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
/** /**
* @brief Unbind any texture from given texture unit * @brief Unbind any texture from given texture unit
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5),
* of OpenGL 4.5), @extension{ARB,multi_bind} (part of OpenGL 4.4) nor * @extension{ARB,multi_bind} (part of OpenGL 4.4) nor
* @extension{EXT,direct_state_access} is available, the texture unit * @extension{EXT,direct_state_access} desktop extension is available,
* is made active before unbinding the texture. * the texture unit is made active before unbinding the texture.
* @note This function is meant to be used only internally from * @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation * @ref AbstractShaderProgram subclasses. See its documentation
* for more information. * for more information.
@ -306,10 +312,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
/** /**
* @brief Bind texture to given texture unit * @brief Bind texture to given texture unit
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5),
* of OpenGL 4.5), @extension{ARB,multi_bind} (part of OpenGL 4.4) nor * @extension{ARB,multi_bind} (part of OpenGL 4.4) nor
* @extension{EXT,direct_state_access} is available, the texture unit * @extension{EXT,direct_state_access} desktop extension is available,
* is made active before binding the texture. * the texture unit is made active before binding the texture.
* @note This function is meant to be used only internally from * @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation * @ref AbstractShaderProgram subclasses. See its documentation
* for more information. * for more information.
@ -340,7 +346,9 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void setBaseLevel(Int level); void setBaseLevel(Int level);
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void setMaxLevel(Int level); void setMaxLevel(Int level);
#endif
void setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap); void setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap);
void setMagnificationFilter(Sampler::Filter filter); void setMagnificationFilter(Sampler::Filter filter);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -350,15 +358,19 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void setLodBias(Float bias); void setLodBias(Float bias);
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
void setBorderColor(const Color4& color); void setBorderColor(const Color4& color);
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void setBorderColor(const Vector4i& color); void setBorderColor(const Vector4i& color);
void setBorderColor(const Vector4ui& color); void setBorderColor(const Vector4ui& color);
#endif #endif
void setMaxAnisotropy(Float anisotropy); void setMaxAnisotropy(Float anisotropy);
#ifndef MAGNUM_TARGET_WEBGL
void setSRGBDecode(bool decode); void setSRGBDecode(bool decode);
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
template<char r, char g, char b, char a> void setSwizzle() { template<char r, char g, char b, char a> void setSwizzle() {
setSwizzleInternal(Implementation::TextureSwizzle<r>::Value, setSwizzleInternal(Implementation::TextureSwizzle<r>::Value,
Implementation::TextureSwizzle<g>::Value, Implementation::TextureSwizzle<g>::Value,
@ -368,9 +380,11 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void setSwizzleInternal(GLint r, GLint g, GLint b, GLint a); void setSwizzleInternal(GLint r, GLint g, GLint b, GLint a);
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void setCompareMode(Sampler::CompareMode mode); void setCompareMode(Sampler::CompareMode mode);
void setCompareFunction(Sampler::CompareFunction function); void setCompareFunction(Sampler::CompareFunction function);
#ifndef MAGNUM_TARGET_GLES2 #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void setDepthStencilMode(Sampler::DepthStencilMode mode); void setDepthStencilMode(Sampler::DepthStencilMode mode);
#endif #endif
void invalidateImage(Int level); void invalidateImage(Int level);
@ -440,7 +454,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat); void MAGNUM_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat);
void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy); void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy);
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values); void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values); void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values);
@ -461,15 +475,23 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size); void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
#endif #endif
#if !defined(MAGNUM_TARGET_WEBGL) || defined(MAGNUM_TARGET_GLES2)
void MAGNUM_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector2i& size); void MAGNUM_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void MAGNUM_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector2i& size); void MAGNUM_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector2i& size); void MAGNUM_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector2i& size); void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL
void MAGNUM_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size); void MAGNUM_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void MAGNUM_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector3i& size); void MAGNUM_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector3i& size); void MAGNUM_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector3i& size); void MAGNUM_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
@ -478,7 +500,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageMultisampleImplementationFallback(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations); void MAGNUM_LOCAL storageMultisampleImplementationFallback(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void MAGNUM_LOCAL storageMultisampleImplementationDefault(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations); void MAGNUM_LOCAL storageMultisampleImplementationDefault(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -512,7 +534,9 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data); void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data);
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); void MAGNUM_LOCAL subImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data);
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); void MAGNUM_LOCAL subImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data);
void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data); void MAGNUM_LOCAL subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data);
@ -571,7 +595,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
}; };
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
static Vector2i imageSize(AbstractTexture& texture, GLint level); static Vector2i imageSize(AbstractTexture& texture, GLint level);
#endif #endif
@ -579,7 +603,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector2i& size); static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
static void setStorageMultisample(AbstractTexture& texture, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedSampleLocations); static void setStorageMultisample(AbstractTexture& texture, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedSampleLocations);
#endif #endif
@ -602,6 +626,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const Vector2i& size); static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const Vector2i& size);
}; };
template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
enum class Target: GLenum { enum class Target: GLenum {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -619,9 +644,11 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
static Vector3i imageSize(AbstractTexture& texture, GLint level); static Vector3i imageSize(AbstractTexture& texture, GLint level);
#endif #endif
#endif
static void setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping); static void setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector3i& size); static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -637,6 +664,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
static void setSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, BufferImage3D& image); static void setSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, BufferImage3D& image);
#endif #endif
#endif
static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const Vector3i& size); static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const Vector3i& size);
}; };

10
src/Magnum/BufferTexture.h

@ -187,9 +187,9 @@ documentation for more information about usage in shaders.
## Performance optimizations ## Performance optimizations
If on desktop GL and either @extension{ARB,direct_state_access} (part of OpenGL If either @extension{ARB,direct_state_access} (part of OpenGL 4.5) or
4.5) or @extension{EXT,direct_state_access} is available, @ref setBuffer() @extension{EXT,direct_state_access} is available, @ref setBuffer() functions
functions use DSA to avoid unnecessary calls to @fn_gl{ActiveTexture} and use DSA to avoid unnecessary calls to @fn_gl{ActiveTexture} and
@fn_gl{BindTexture}. See @fn_gl{BindTexture}. See
@ref AbstractTexture-performance-optimization "relevant section in AbstractTexture documentation" @ref AbstractTexture-performance-optimization "relevant section in AbstractTexture documentation"
and respective function documentation for more information. and respective function documentation for more information.
@ -197,7 +197,7 @@ and respective function documentation for more information.
@see @ref Texture, @ref TextureArray, @ref CubeMapTexture, @see @ref Texture, @ref TextureArray, @ref CubeMapTexture,
@ref CubeMapTextureArray, @ref RectangleTexture, @ref MultisampleTexture @ref CubeMapTextureArray, @ref RectangleTexture, @ref MultisampleTexture
@requires_gl31 Extension @extension{ARB,texture_buffer_object} @requires_gl31 Extension @extension{ARB,texture_buffer_object}
@requires_gl Texture buffers are not available in OpenGL ES. @requires_gl Texture buffers are not available in OpenGL ES or WebGL.
*/ */
class MAGNUM_EXPORT BufferTexture: public AbstractTexture { class MAGNUM_EXPORT BufferTexture: public AbstractTexture {
friend Implementation::TextureState; friend Implementation::TextureState;
@ -227,7 +227,7 @@ class MAGNUM_EXPORT BufferTexture: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_BUFFER}, eventually * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_BUFFER}, eventually
* @fn_gl{GenTextures} * @fn_gl{GenTextures}

11
src/Magnum/CMakeLists.txt

@ -154,11 +154,10 @@ if(NOT TARGET_GLES)
RectangleTexture.h) RectangleTexture.h)
endif() endif()
# Non-ES2 stuff # OpenGL ES 3.0 and WebGL 2.0 stuff
if(NOT TARGET_GLES2) if(NOT TARGET_GLES2)
list(APPEND Magnum_SRCS list(APPEND Magnum_SRCS
BufferImage.cpp BufferImage.cpp
MultisampleTexture.cpp
TextureArray.cpp TextureArray.cpp
TransformFeedback.cpp TransformFeedback.cpp
@ -166,7 +165,6 @@ if(NOT TARGET_GLES2)
list(APPEND Magnum_HEADERS list(APPEND Magnum_HEADERS
BufferImage.h BufferImage.h
MultisampleTexture.h
PrimitiveQuery.h PrimitiveQuery.h
TextureArray.h TextureArray.h
TransformFeedback.h) TransformFeedback.h)
@ -176,7 +174,7 @@ if(NOT TARGET_GLES2)
endif() endif()
# Non-WebGL stuff # Desktop and OpenGL ES stuff that is not available in WebGL
if(NOT TARGET_WEBGL) if(NOT TARGET_WEBGL)
list(APPEND Magnum_SRCS list(APPEND Magnum_SRCS
DebugOutput.cpp DebugOutput.cpp
@ -189,6 +187,11 @@ if(NOT TARGET_WEBGL)
list(APPEND Magnum_PRIVATE_HEADERS list(APPEND Magnum_PRIVATE_HEADERS
Implementation/DebugState.h) Implementation/DebugState.h)
if(NOT TARGET_GLES2)
list(APPEND Magnum_SRCS MultisampleTexture.cpp)
list(APPEND Magnum_HEADERS MultisampleTexture.h)
endif()
if(BUILD_DEPRECATED) if(BUILD_DEPRECATED)
list(APPEND Magnum_HEADERS list(APPEND Magnum_HEADERS
DebugMarker.h DebugMarker.h

4
src/Magnum/CubeMapTexture.cpp

@ -49,7 +49,7 @@ Vector2i CubeMapTexture::maxSize() {
return Vector2i{Implementation::maxCubeMapTextureSideSize()}; return Vector2i{Implementation::maxCubeMapTextureSideSize()};
} }
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i CubeMapTexture::imageSize(const Int level) { Vector2i CubeMapTexture::imageSize(const Int level) {
return (this->*Context::current()->state().texture->getCubeImageSizeImplementation)(level); return (this->*Context::current()->state().texture->getCubeImageSizeImplementation)(level);
} }
@ -153,7 +153,7 @@ CubeMapTexture& CubeMapTexture::setSubImage(const Coordinate coordinate, const I
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i CubeMapTexture::getImageSizeImplementationDefault(const Int level) { Vector2i CubeMapTexture::getImageSizeImplementationDefault(const Int level) {
Vector2i size; Vector2i size;
bindInternal(); bindInternal();

100
src/Magnum/CubeMapTexture.h

@ -106,7 +106,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP}, * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP},
* eventually @fn_gl{GenTextures} * eventually @fn_gl{GenTextures}
@ -120,6 +120,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* See @ref Texture::setBaseLevel() for more information. * See @ref Texture::setBaseLevel() for more information.
* @requires_gles30 Base level is always `0` in OpenGL ES 2.0. * @requires_gles30 Base level is always `0` in OpenGL ES 2.0.
* @requires_webgl20 Base level is always `0` in WebGL 1.0.
*/ */
CubeMapTexture& setBaseLevel(Int level) { CubeMapTexture& setBaseLevel(Int level) {
AbstractTexture::setBaseLevel(level); AbstractTexture::setBaseLevel(level);
@ -127,6 +128,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* @copybrief Texture::setMaxLevel() * @copybrief Texture::setMaxLevel()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -135,11 +137,13 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gles30 Extension @es_extension{APPLE,texture_max_level}, * @requires_gles30 Extension @es_extension{APPLE,texture_max_level},
* otherwise the max level is always set to largest possible value * otherwise the max level is always set to largest possible value
* in OpenGL ES 2.0. * in OpenGL ES 2.0.
* @requires_webgl20 Always set to largest possible value in WebGL 1.0.
*/ */
CubeMapTexture& setMaxLevel(Int level) { CubeMapTexture& setMaxLevel(Int level) {
AbstractTexture::setMaxLevel(level); AbstractTexture::setMaxLevel(level);
return *this; return *this;
} }
#endif
/** /**
* @copybrief Texture::setMinificationFilter() * @copybrief Texture::setMinificationFilter()
@ -171,6 +175,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setMinLod() for more information. * See @ref Texture::setMinLod() for more information.
* @requires_gles30 Texture LOD parameters are not available in OpenGL * @requires_gles30 Texture LOD parameters are not available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Texture LOD parameters are not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setMinLod(Float lod) { CubeMapTexture& setMinLod(Float lod) {
AbstractTexture::setMinLod(lod); AbstractTexture::setMinLod(lod);
@ -184,6 +190,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setMaxLod() for more information. * See @ref Texture::setMaxLod() for more information.
* @requires_gles30 Texture LOD parameters are not available in OpenGL * @requires_gles30 Texture LOD parameters are not available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Texture LOD parameters are not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setMaxLod(Float lod) { CubeMapTexture& setMaxLod(Float lod) {
AbstractTexture::setMaxLod(lod); AbstractTexture::setMaxLod(lod);
@ -198,7 +206,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* See @ref Texture::setLodBias() for more information. * See @ref Texture::setLodBias() for more information.
* @requires_gl Texture LOD bias can be specified only directly in * @requires_gl Texture LOD bias can be specified only directly in
* fragment shader in OpenGL ES. * fragment shader in OpenGL ES and WebGL.
*/ */
CubeMapTexture& setLodBias(Float bias) { CubeMapTexture& setLodBias(Float bias) {
AbstractTexture::setLodBias(bias); AbstractTexture::setLodBias(bias);
@ -217,6 +225,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::setBorderColor(const Color4&) * @copybrief Texture::setBorderColor(const Color4&)
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -224,11 +233,13 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setBorderColor(const Color4&) for more * See @ref Texture::setBorderColor(const Color4&) for more
* information. * information.
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Color4& color) { CubeMapTexture& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -238,8 +249,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setBorderColor(const Vector4ui&) for more * See @ref Texture::setBorderColor(const Vector4ui&) for more
* information. * information.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Vector4ui& color) { CubeMapTexture& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -248,8 +259,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Vector4i& color) { CubeMapTexture& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -268,6 +279,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::setSRGBDecode() * @copybrief Texture::setSRGBDecode()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -277,13 +289,15 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_es_extension OpenGL ES 3.0 or extension * @requires_es_extension OpenGL ES 3.0 or extension
* @es_extension{EXT,sRGB} and * @es_extension{EXT,sRGB} and
* @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} * @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode}
* @requires_gles SRGB decode is not available in WebGL.
*/ */
CubeMapTexture& setSRGBDecode(bool decode) { CubeMapTexture& setSRGBDecode(bool decode) {
AbstractTexture::setSRGBDecode(decode); AbstractTexture::setSRGBDecode(decode);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @copybrief Texture::setSwizzle() * @copybrief Texture::setSwizzle()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -291,6 +305,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setSwizzle() for more information. * See @ref Texture::setSwizzle() for more information.
* @requires_gl33 Extension @extension{ARB,texture_swizzle} * @requires_gl33 Extension @extension{ARB,texture_swizzle}
* @requires_gles30 Texture swizzle is not available in OpenGL ES 2.0. * @requires_gles30 Texture swizzle is not available in OpenGL ES 2.0.
* @requires_gles Texture swizzle is not available in WebGL.
*/ */
template<char r, char g, char b, char a> CubeMapTexture& setSwizzle() { template<char r, char g, char b, char a> CubeMapTexture& setSwizzle() {
AbstractTexture::setSwizzle<r, g, b, a>(); AbstractTexture::setSwizzle<r, g, b, a>();
@ -298,13 +313,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* @copybrief Texture::setCompareMode() * @copybrief Texture::setCompareMode()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* See @ref Texture::setCompareMode() for more information. * See @ref Texture::setCompareMode() for more information.
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} and * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} and
* @es_extension{NV,shadow_samplers_cube} * @es_extension{NV,shadow_samplers_cube} in OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setCompareMode(Sampler::CompareMode mode) { CubeMapTexture& setCompareMode(Sampler::CompareMode mode) {
AbstractTexture::setCompareMode(mode); AbstractTexture::setCompareMode(mode);
@ -317,14 +335,17 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* See @ref Texture::setCompareFunction() for more information. * See @ref Texture::setCompareFunction() for more information.
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} and * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} and
* @es_extension{NV,shadow_samplers_cube} * @es_extension{NV,shadow_samplers_cube} in OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setCompareFunction(Sampler::CompareFunction function) { CubeMapTexture& setCompareFunction(Sampler::CompareFunction function) {
AbstractTexture::setCompareFunction(function); AbstractTexture::setCompareFunction(function);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @copybrief Texture::setDepthStencilMode() * @copybrief Texture::setDepthStencilMode()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -333,6 +354,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gl43 Extension @extension{ARB,stencil_texturing} * @requires_gl43 Extension @extension{ARB,stencil_texturing}
* @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0
* and older. * and older.
* @requires_gles Stencil texturing is not available in WebGL.
*/ */
CubeMapTexture& setDepthStencilMode(Sampler::DepthStencilMode mode) { CubeMapTexture& setDepthStencilMode(Sampler::DepthStencilMode mode) {
AbstractTexture::setDepthStencilMode(mode); AbstractTexture::setDepthStencilMode(mode);
@ -352,16 +374,18 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @copybrief Texture::imageSize() * @copybrief Texture::imageSize()
* *
* If on OpenGL ES or @extension{ARB,direct_state_access} (part of * If @extension{ARB,direct_state_access} (part of OpenGL 4.5) is not
* OpenGL 4.5) is not available, it is assumed that faces have the same * available, it is assumed that faces have the same size and just the
* size and just the size of @ref Coordinate::PositiveX face is * size of @ref Coordinate::PositiveX face is queried. See
* queried. See @ref Texture::imageSize() for more information. * @ref Texture::imageSize() for more information.
* @requires_gles31 Texture image size queries are not available in * @requires_gles31 Texture image size queries are not available in
* OpenGL ES 3.0 and older. * OpenGL ES 3.0 and older.
* @requires_gles Texture image size queries are not available in
* WebGL.
*/ */
Vector2i imageSize(Int level); Vector2i imageSize(Int level);
@ -387,8 +411,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT}, then * @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT}, then
* @fn_gl{GetTextureImage} * @fn_gl{GetTextureImage}
* @requires_gl45 Extension @extension{ARB,direct_state_access} * @requires_gl45 Extension @extension{ARB,direct_state_access}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Int level, Image3D& image); void image(Int level, Image3D& image);
@ -406,8 +430,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* See @ref image(Int, Image3D&) for more information. * See @ref image(Int, Image3D&) for more information.
* @requires_gl45 Extension @extension{ARB,direct_state_access} * @requires_gl45 Extension @extension{ARB,direct_state_access}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Int level, BufferImage3D& image, BufferUsage usage); void image(Int level, BufferImage3D& image, BufferUsage usage);
@ -444,8 +468,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @fn_gl_extension{GetnTexImage,ARB,robustness}, * @fn_gl_extension{GetnTexImage,ARB,robustness},
* @fn_gl_extension{GetTextureImage,EXT,direct_state_access}, * @fn_gl_extension{GetTextureImage,EXT,direct_state_access},
* eventually @fn_gl{GetTexImage} * eventually @fn_gl{GetTexImage}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Coordinate coordinate, Int level, Image2D& image); void image(Coordinate coordinate, Int level, Image2D& image);
@ -462,8 +486,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @brief Read given mip level and coordinate of texture to buffer image * @brief Read given mip level and coordinate of texture to buffer image
* *
* See @ref image(Coordinate, Int, Image2D&) for more information. * See @ref image(Coordinate, Int, Image2D&) for more information.
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Coordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage); void image(Coordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage);
@ -482,8 +506,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&) * See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
* for more information. * for more information.
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const Range3Di& range, Image3D& image) { void subImage(Int level, const Range3Di& range, Image3D& image) {
AbstractTexture::subImage<3>(level, range, image); AbstractTexture::subImage<3>(level, range, image);
@ -504,8 +528,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage) * See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage)
* for more information. * for more information.
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage) { void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage) {
AbstractTexture::subImage<3>(level, range, image, usage); AbstractTexture::subImage<3>(level, range, image, usage);
@ -539,6 +563,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage() * @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead. * instead.
*/ */
@ -550,6 +576,8 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage() * @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead. * instead.
*/ */
@ -569,22 +597,22 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* @see @ref setStorage(), @fn_gl2{TextureSubImage3D,TexSubImage3D} * @see @ref setStorage(), @fn_gl2{TextureSubImage3D,TexSubImage3D}
* @requires_gl45 Extension @extension{ARB,direct_state_access} * @requires_gl45 Extension @extension{ARB,direct_state_access}
* @requires_gl In OpenGL ES you need to set image for each face * @requires_gl In OpenGL ES and WebGL you need to set image for each
* separately. * face separately.
*/ */
CubeMapTexture& setSubImage(Int level, const Vector3i& offset, const ImageReference3D& image); CubeMapTexture& setSubImage(Int level, const Vector3i& offset, const ImageReference3D& image);
/** @overload /** @overload
* @requires_gl45 Extension @extension{ARB,direct_state_access} * @requires_gl45 Extension @extension{ARB,direct_state_access}
* @requires_gl In OpenGL ES you need to set image for each face * @requires_gl In OpenGL ES and WebGL you need to set image for each
* separately. * face separately.
*/ */
CubeMapTexture& setSubImage(Int level, const Vector3i& offset, BufferImage3D& image); CubeMapTexture& setSubImage(Int level, const Vector3i& offset, BufferImage3D& image);
/** @overload /** @overload
* @requires_gl45 Extension @extension{ARB,direct_state_access} * @requires_gl45 Extension @extension{ARB,direct_state_access}
* @requires_gl In OpenGL ES you need to set image for each face * @requires_gl In OpenGL ES and WebGL you need to set image for each
* separately. * face separately.
*/ */
CubeMapTexture& setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) { CubeMapTexture& setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) {
return setSubImage(level, offset, image); return setSubImage(level, offset, image);
@ -603,12 +631,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image); CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image);
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/ */
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) { CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) {
return setSubImage(coordinate, level, offset, image); return setSubImage(coordinate, level, offset, image);
@ -660,11 +692,13 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
#endif #endif
private: private:
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i MAGNUM_LOCAL getImageSizeImplementationDefault(Int level); Vector2i MAGNUM_LOCAL getImageSizeImplementationDefault(Int level);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Vector2i MAGNUM_LOCAL getImageSizeImplementationDSA(Int level); Vector2i MAGNUM_LOCAL getImageSizeImplementationDSA(Int level);
Vector2i MAGNUM_LOCAL getImageSizeImplementationDSAEXT(Int level); Vector2i MAGNUM_LOCAL getImageSizeImplementationDSAEXT(Int level);
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data); void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, ColorFormat format, ColorType type, std::size_t dataSize, GLvoid* data);

4
src/Magnum/CubeMapTextureArray.h

@ -80,7 +80,7 @@ the six sides of the cube map, fourth part is layer in the array. See
@ref Texture, @ref TextureArray, @ref RectangleTexture, @ref BufferTexture, @ref Texture, @ref TextureArray, @ref RectangleTexture, @ref BufferTexture,
@ref MultisampleTexture @ref MultisampleTexture
@requires_gl40 Extension @extension{ARB,texture_cube_map_array} @requires_gl40 Extension @extension{ARB,texture_cube_map_array}
@requires_gl Cube map texture arrays are not available in OpenGL ES. @requires_gl Cube map texture arrays are not available in OpenGL ES or WebGL.
*/ */
class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture {
public: public:
@ -88,7 +88,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP_ARRAY}, * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP_ARRAY},
* eventually @fn_gl{GenTextures} * eventually @fn_gl{GenTextures}

27
src/Magnum/Implementation/TextureState.cpp

@ -38,7 +38,11 @@
namespace Magnum { namespace Implementation { namespace Magnum { namespace Implementation {
TextureState::TextureState(Context& context, std::vector<std::string>& extensions): maxSize{}, max3DSize{}, maxCubeMapSize{}, TextureState::TextureState(Context& context, std::vector<std::string>& extensions): maxSize{},
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
max3DSize{},
#endif
maxCubeMapSize{},
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
maxArrayLayers{}, maxArrayLayers{},
#endif #endif
@ -165,7 +169,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault; parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault;
parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault; parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault;
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
getLevelParameterivImplementation = &AbstractTexture::getLevelParameterImplementationDefault; getLevelParameterivImplementation = &AbstractTexture::getLevelParameterImplementationDefault;
#endif #endif
mipmapImplementation = &AbstractTexture::mipmapImplementationDefault; mipmapImplementation = &AbstractTexture::mipmapImplementationDefault;
@ -173,14 +177,16 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
subImage1DImplementation = &AbstractTexture::subImageImplementationDefault; subImage1DImplementation = &AbstractTexture::subImageImplementationDefault;
#endif #endif
subImage2DImplementation = &AbstractTexture::subImageImplementationDefault; subImage2DImplementation = &AbstractTexture::subImageImplementationDefault;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
subImage3DImplementation = &AbstractTexture::subImageImplementationDefault; subImage3DImplementation = &AbstractTexture::subImageImplementationDefault;
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
setBufferImplementation = &BufferTexture::setBufferImplementationDefault; setBufferImplementation = &BufferTexture::setBufferImplementationDefault;
setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault; setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault;
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
getCubeImageSizeImplementation = &CubeMapTexture::getImageSizeImplementationDefault; getCubeImageSizeImplementation = &CubeMapTexture::getImageSizeImplementationDefault;
#endif #endif
cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault; cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDefault;
@ -232,7 +238,8 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
} else getCubeImageImplementation = &CubeMapTexture::getImageImplementationDefault; } else getCubeImageImplementation = &CubeMapTexture::getImageImplementationDefault;
#endif #endif
/* Texture storage implementation */ /* Texture storage implementation for desktop and ES */
#ifndef MAGNUM_TARGET_WEBGL
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::ARB::texture_storage>()) if(context.isExtensionSupported<Extensions::GL::ARB::texture_storage>())
#elif defined(MAGNUM_TARGET_GLES2) #elif defined(MAGNUM_TARGET_GLES2)
@ -275,6 +282,16 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
} }
#endif #endif
/* Texture storage implementation for WebGL 1.0 */
#elif defined(MAGNUM_TARGET_GLES2)
storage2DImplementation = &AbstractTexture::storageImplementationFallback;
/* Texture storage implementation for WebGL 2.0 */
#else
storage2DImplementation = &AbstractTexture::storageImplementationDefault;
storage3DImplementation = &AbstractTexture::storageImplementationDefault;
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Storage implementation for multisample textures. The fallback doesn't /* Storage implementation for multisample textures. The fallback doesn't
have DSA alternative, so it must be handled specially. */ have DSA alternative, so it must be handled specially. */
@ -295,7 +312,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback; storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback;
storage3DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback; storage3DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback;
} }
#elif !defined(MAGNUM_TARGET_GLES2) #elif !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationDefault; storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationDefault;
#endif #endif

12
src/Magnum/Implementation/TextureState.h

@ -53,7 +53,7 @@ struct TextureState {
void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*); void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*);
#endif #endif
void(AbstractTexture::*setMaxAnisotropyImplementation)(GLfloat); void(AbstractTexture::*setMaxAnisotropyImplementation)(GLfloat);
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void(AbstractTexture::*getLevelParameterivImplementation)(GLint, GLenum, GLint*); void(AbstractTexture::*getLevelParameterivImplementation)(GLint, GLenum, GLint*);
#endif #endif
void(AbstractTexture::*mipmapImplementation)(); void(AbstractTexture::*mipmapImplementation)();
@ -61,8 +61,10 @@ struct TextureState {
void(AbstractTexture::*storage1DImplementation)(GLsizei, TextureFormat, const Math::Vector<1, GLsizei>&); void(AbstractTexture::*storage1DImplementation)(GLsizei, TextureFormat, const Math::Vector<1, GLsizei>&);
#endif #endif
void(AbstractTexture::*storage2DImplementation)(GLsizei, TextureFormat, const Vector2i&); void(AbstractTexture::*storage2DImplementation)(GLsizei, TextureFormat, const Vector2i&);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void(AbstractTexture::*storage3DImplementation)(GLsizei, TextureFormat, const Vector3i&); void(AbstractTexture::*storage3DImplementation)(GLsizei, TextureFormat, const Vector3i&);
#ifndef MAGNUM_TARGET_GLES2 #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void(AbstractTexture::*storage2DMultisampleImplementation)(GLsizei, TextureFormat, const Vector2i&, GLboolean); void(AbstractTexture::*storage2DMultisampleImplementation)(GLsizei, TextureFormat, const Vector2i&, GLboolean);
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -73,7 +75,9 @@ struct TextureState {
void(AbstractTexture::*subImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, ColorFormat, ColorType, const GLvoid*); void(AbstractTexture::*subImage1DImplementation)(GLint, const Math::Vector<1, GLint>&, const Math::Vector<1, GLsizei>&, ColorFormat, ColorType, const GLvoid*);
#endif #endif
void(AbstractTexture::*subImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*); void(AbstractTexture::*subImage2DImplementation)(GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void(AbstractTexture::*subImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, ColorFormat, ColorType, const GLvoid*); void(AbstractTexture::*subImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, ColorFormat, ColorType, const GLvoid*);
#endif
void(AbstractTexture::*invalidateImageImplementation)(GLint); void(AbstractTexture::*invalidateImageImplementation)(GLint);
void(AbstractTexture::*invalidateSubImageImplementation)(GLint, const Vector3i&, const Vector3i&); void(AbstractTexture::*invalidateSubImageImplementation)(GLint, const Vector3i&, const Vector3i&);
@ -82,7 +86,7 @@ struct TextureState {
void(BufferTexture::*setBufferRangeImplementation)(BufferTextureFormat, Buffer&, GLintptr, GLsizeiptr); void(BufferTexture::*setBufferRangeImplementation)(BufferTextureFormat, Buffer&, GLintptr, GLsizeiptr);
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i(CubeMapTexture::*getCubeImageSizeImplementation)(Int); Vector2i(CubeMapTexture::*getCubeImageSizeImplementation)(Int);
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -91,7 +95,9 @@ struct TextureState {
void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*); void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, ColorFormat, ColorType, const GLvoid*);
GLint maxSize, GLint maxSize,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
max3DSize, max3DSize,
#endif
maxCubeMapSize; maxCubeMapSize;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GLint maxArrayLayers; GLint maxArrayLayers;

2
src/Magnum/Implementation/maxTextureSize.cpp

@ -41,6 +41,7 @@ GLint maxTextureSideSize() {
return value; return value;
} }
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
GLint max3DTextureDepth() { GLint max3DTextureDepth() {
GLint& value = Context::current()->state().texture->max3DSize; GLint& value = Context::current()->state().texture->max3DSize;
@ -53,6 +54,7 @@ GLint max3DTextureDepth() {
return value; return value;
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GLint maxTextureArrayLayers() { GLint maxTextureArrayLayers() {

2
src/Magnum/Implementation/maxTextureSize.h

@ -30,7 +30,9 @@
namespace Magnum { namespace Implementation { namespace Magnum { namespace Implementation {
GLint maxTextureSideSize(); GLint maxTextureSideSize();
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
GLint max3DTextureDepth(); GLint max3DTextureDepth();
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GLint maxTextureArrayLayers(); GLint maxTextureArrayLayers();
#endif #endif

26
src/Magnum/MultisampleTexture.h

@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** @file /** @file
* @brief Class @ref Magnum::MultisampleTexture, typedef @ref Magnum::MultisampleTexture2D, @ref Magnum::MultisampleTexture2DArray * @brief Class @ref Magnum::MultisampleTexture, typedef @ref Magnum::MultisampleTexture2D, @ref Magnum::MultisampleTexture2DArray
*/ */
@ -35,7 +35,7 @@
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h" #include "Magnum/Math/Vector3.h"
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
namespace Magnum { namespace Magnum {
namespace Implementation { namespace Implementation {
@ -90,7 +90,8 @@ shaders.
@requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and @requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and
older. older.
@requires_gl 2D array multisample textures are not available in OpenGL ES, only @requires_gl 2D array multisample textures are not available in OpenGL ES, only
2D ones. 2D ones. No multisample textures are available in WebGL.
@requires_gles Multisample textures are not available in WebGL.
*/ */
template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTexture { template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTexture {
public: public:
@ -114,7 +115,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_2D_MULTISAMPLE} or * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_2D_MULTISAMPLE} or
* @def_gl{TEXTURE_2D_MULTISAMPLE_ARRAY}, eventually * @def_gl{TEXTURE_2D_MULTISAMPLE_ARRAY}, eventually
@ -133,12 +134,13 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
* After calling this function the texture is immutable and calling * After calling this function the texture is immutable and calling
* @ref setStorage() again is not allowed. * @ref setStorage() again is not allowed.
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). If * available, the texture is bound before the operation (if not
* @extension{ARB,texture_storage_multisample} (part of OpenGL 4.3) is * already). If @extension{ARB,texture_storage_multisample} (part of
* not available, the texture is bound and the feature is emulated * OpenGL 4.3) is not available, the texture is bound and the feature
* using plain @extension{ARB,texture_multisample} functionality. * is emulated using plain @extension{ARB,texture_multisample}
* functionality.
* @see @ref maxSize(), @ref maxColorSamples(), @ref maxDepthSamples(), * @see @ref maxSize(), @ref maxColorSamples(), @ref maxDepthSamples(),
* @ref maxIntegerSamples(), @fn_gl2{TextureStorage2DMultisample,TexStorage2DMultisample} / * @ref maxIntegerSamples(), @fn_gl2{TextureStorage2DMultisample,TexStorage2DMultisample} /
* @fn_gl2{TextureStorage3DMultisample,TexStorage3DMultisample}, * @fn_gl2{TextureStorage3DMultisample,TexStorage3DMultisample},
@ -211,6 +213,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
@requires_gl32 Extension @extension{ARB,texture_multisample} @requires_gl32 Extension @extension{ARB,texture_multisample}
@requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and @requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and
older. older.
@requires_gles Multisample textures are not available in WebGL.
*/ */
typedef MultisampleTexture<2> MultisampleTexture2D; typedef MultisampleTexture<2> MultisampleTexture2D;
@ -220,13 +223,14 @@ typedef MultisampleTexture<2> MultisampleTexture2D;
@requires_gl32 Extension @extension{ARB,texture_multisample} @requires_gl32 Extension @extension{ARB,texture_multisample}
@requires_gl Only @ref MultisampleTexture2D is available in OpenGL ES. @requires_gl Only @ref MultisampleTexture2D is available in OpenGL ES.
No multisample textures are available in WebGL.
*/ */
typedef MultisampleTexture<3> MultisampleTexture2DArray; typedef MultisampleTexture<3> MultisampleTexture2DArray;
#endif #endif
} }
#else #else
#error this header is not available in OpenGL ES 2.0 build #error this header is not available in OpenGL ES 2.0 and WebGL build
#endif #endif
#endif #endif

4
src/Magnum/RectangleTexture.h

@ -66,7 +66,7 @@ documentation for more information about usage in shaders.
@see @ref Texture, @ref TextureArray, @ref CubeMapTexture, @see @ref Texture, @ref TextureArray, @ref CubeMapTexture,
@ref CubeMapTextureArray, @ref BufferTexture, @ref MultisampleTexture @ref CubeMapTextureArray, @ref BufferTexture, @ref MultisampleTexture
@requires_gl31 Extension @extension{ARB,texture_rectangle} @requires_gl31 Extension @extension{ARB,texture_rectangle}
@requires_gl Rectangle textures are not available in OpenGL ES. @requires_gl Rectangle textures are not available in OpenGL ES and WebGL.
*/ */
class MAGNUM_EXPORT RectangleTexture: public AbstractTexture { class MAGNUM_EXPORT RectangleTexture: public AbstractTexture {
public: public:
@ -84,7 +84,7 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_RECTANGLE}, * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_RECTANGLE},
* eventually @fn_gl{GenTextures} * eventually @fn_gl{GenTextures}

4
src/Magnum/Sampler.cpp

@ -90,7 +90,9 @@ Debug operator<<(Debug debug, const Sampler::Wrapping value) {
_c(Repeat) _c(Repeat)
_c(MirroredRepeat) _c(MirroredRepeat)
_c(ClampToEdge) _c(ClampToEdge)
#ifndef MAGNUM_TARGET_WEBGL
_c(ClampToBorder) _c(ClampToBorder)
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
_c(MirrorClampToEdge) _c(MirrorClampToEdge)
#endif #endif
@ -100,6 +102,7 @@ Debug operator<<(Debug debug, const Sampler::Wrapping value) {
return debug << "Sampler::Wrapping::(invalid)"; return debug << "Sampler::Wrapping::(invalid)";
} }
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
Debug operator<<(Debug debug, const Sampler::CompareMode value) { Debug operator<<(Debug debug, const Sampler::CompareMode value) {
switch(value) { switch(value) {
#define _c(value) case Sampler::CompareMode::value: return debug << "Sampler::CompareMode::" #value; #define _c(value) case Sampler::CompareMode::value: return debug << "Sampler::CompareMode::" #value;
@ -127,6 +130,7 @@ Debug operator<<(Debug debug, const Sampler::CompareFunction value) {
return debug << "Sampler::CompareFunction::(invalid)"; return debug << "Sampler::CompareFunction::(invalid)";
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Debug operator<<(Debug debug, const Sampler::DepthStencilMode value) { Debug operator<<(Debug debug, const Sampler::DepthStencilMode value) {

35
src/Magnum/Sampler.h

@ -58,7 +58,11 @@ class MAGNUM_EXPORT Sampler {
* @es_extension2{OES,texture_half_float_linear,OES_texture_float_linear} * @es_extension2{OES,texture_half_float_linear,OES_texture_float_linear}
* for linear interpolation of textures with * for linear interpolation of textures with
* @ref TextureFormat::HalfFloat / @ref TextureFormat::Float * @ref TextureFormat::HalfFloat / @ref TextureFormat::Float
* in OpenGL ES 2.0 * in OpenGL ES 2.0.
* @requires_webgl20 Extension @webgl_extension{OES,texture_float_linear}
* / @webgl_extension{OES,texture_half_float_linear} for
* linear interpolation of textures with @ref TextureFormat::HalfFloat
* / @ref TextureFormat::Float in WebGL 1.0.
*/ */
Linear = GL_LINEAR Linear = GL_LINEAR
}; };
@ -84,6 +88,10 @@ class MAGNUM_EXPORT Sampler {
* for linear interpolation of textures with * for linear interpolation of textures with
* @ref TextureFormat::HalfFloat / @ref TextureFormat::Float * @ref TextureFormat::HalfFloat / @ref TextureFormat::Float
* in OpenGL ES 2.0. * in OpenGL ES 2.0.
* @requires_webgl20 Extension @webgl_extension{OES,texture_float_linear}
* / @webgl_extension{OES,texture_half_float_linear} for
* linear interpolation of textures with @ref TextureFormat::HalfFloat
* / @ref TextureFormat::Float in WebGL 1.0.
*/ */
Linear = GL_NEAREST_MIPMAP_LINEAR & ~GL_NEAREST Linear = GL_NEAREST_MIPMAP_LINEAR & ~GL_NEAREST
}; };
@ -108,17 +116,20 @@ class MAGNUM_EXPORT Sampler {
*/ */
ClampToEdge = GL_CLAMP_TO_EDGE, ClampToEdge = GL_CLAMP_TO_EDGE,
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* Clamp to border color. Coordinates out of range will be clamped * Clamp to border color. Coordinates out of range will be clamped
* to border color (set with * to border color (set with
* @ref Texture::setBorderColor() "*Texture::setBorderColor()"). * @ref Texture::setBorderColor() "*Texture::setBorderColor()").
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
ClampToBorder = GL_CLAMP_TO_BORDER, ClampToBorder = GL_CLAMP_TO_BORDER,
#else #else
ClampToBorder = GL_CLAMP_TO_BORDER_NV, ClampToBorder = GL_CLAMP_TO_BORDER_NV,
#endif #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -127,18 +138,23 @@ class MAGNUM_EXPORT Sampler {
* @requires_gl44 Extension @extension{ARB,texture_mirror_clamp_to_edge}, * @requires_gl44 Extension @extension{ARB,texture_mirror_clamp_to_edge},
* @extension{ATI,texture_mirror_once} or @extension{EXT,texture_mirror_clamp} * @extension{ATI,texture_mirror_once} or @extension{EXT,texture_mirror_clamp}
* @requires_gl Only separate @ref Wrapping::MirroredRepeat or * @requires_gl Only separate @ref Wrapping::MirroredRepeat or
* @ref Wrapping::ClampToEdge is available in OpenGL ES. * @ref Wrapping::ClampToEdge is available in OpenGL ES and
* WebGL.
*/ */
MirrorClampToEdge = GL_MIRROR_CLAMP_TO_EDGE MirrorClampToEdge = GL_MIRROR_CLAMP_TO_EDGE
#endif #endif
}; };
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* @brief Depth texture comparison mode * @brief Depth texture comparison mode
* *
* @see @ref CompareFunction, * @see @ref CompareFunction,
* @ref Texture::setCompareMode() "*Texture::setCompareMode()" * @ref Texture::setCompareMode() "*Texture::setCompareMode()"
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} in
* OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
enum class CompareMode: GLenum { enum class CompareMode: GLenum {
/** Directly output the depth value */ /** Directly output the depth value */
@ -160,7 +176,10 @@ class MAGNUM_EXPORT Sampler {
* @ref CompareMode::CompareRefToTexture. * @ref CompareMode::CompareRefToTexture.
* @see @ref Texture::setCompareFunction() "*Texture::setCompareFunction()", * @see @ref Texture::setCompareFunction() "*Texture::setCompareFunction()",
* @ref Texture::setCompareMode() "*Texture::setCompareMode()" * @ref Texture::setCompareMode() "*Texture::setCompareMode()"
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} in
* OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
enum class CompareFunction: GLenum { enum class CompareFunction: GLenum {
Never = GL_NEVER, /**< Always `0.0` */ Never = GL_NEVER, /**< Always `0.0` */
@ -202,15 +221,17 @@ class MAGNUM_EXPORT Sampler {
*/ */
Greater = GL_GREATER Greater = GL_GREATER
}; };
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Depth/stencil texture mode * @brief Depth/stencil texture mode
* *
* @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" * @see @ref Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()"
* @requires_gl43 Extension @extension{ARB,stencil_texturing} * @requires_gl43 Extension @extension{ARB,stencil_texturing}
* @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0
* and older * and older.
* @requires_gles Stencil texturing is not available in WebGL.
*/ */
enum class DepthStencilMode: GLenum { enum class DepthStencilMode: GLenum {
/** Sample depth component */ /** Sample depth component */
@ -241,11 +262,13 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Mipmap value);
/** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::Wrapping} */ /** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::Wrapping} */
Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Wrapping value); Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Wrapping value);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::CompareMode} */ /** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::CompareMode} */
Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::CompareMode value); Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::CompareMode value);
/** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::CompareFunction} */ /** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::CompareFunction} */
Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::CompareFunction value); Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::CompareFunction value);
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::DepthStencilMode} */ /** @debugoperatorclassenum{Magnum::Sampler,Magnum::Sampler::DepthStencilMode} */

2
src/Magnum/Texture.cpp

@ -50,6 +50,7 @@ template MAGNUM_EXPORT Math::Vector<1, Int> maxTextureSize<1>();
#endif #endif
template MAGNUM_EXPORT Vector2i maxTextureSize<2>(); template MAGNUM_EXPORT Vector2i maxTextureSize<2>();
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>() { template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
if(!Context::current()->isExtensionSupported<Extensions::GL::OES::texture_3D>()) if(!Context::current()->isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -57,6 +58,7 @@ template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>() {
#endif #endif
return {Vector2i(Implementation::maxTextureSideSize()), Implementation::max3DTextureDepth()}; return {Vector2i(Implementation::maxTextureSideSize()), Implementation::max3DTextureDepth()};
} }
#endif
} }

235
src/Magnum/Texture.h

@ -44,6 +44,7 @@ namespace Implementation {
template<> constexpr GLenum textureTarget<1>() { return GL_TEXTURE_1D; } template<> constexpr GLenum textureTarget<1>() { return GL_TEXTURE_1D; }
#endif #endif
template<> constexpr GLenum textureTarget<2>() { return GL_TEXTURE_2D; } template<> constexpr GLenum textureTarget<2>() { return GL_TEXTURE_2D; }
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
template<> constexpr GLenum textureTarget<3>() { template<> constexpr GLenum textureTarget<3>() {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
return GL_TEXTURE_3D; return GL_TEXTURE_3D;
@ -51,6 +52,7 @@ namespace Implementation {
return GL_TEXTURE_3D_OES; return GL_TEXTURE_3D_OES;
#endif #endif
} }
#endif
template<UnsignedInt dimensions> VectorTypeFor<dimensions, Int> maxTextureSize(); template<UnsignedInt dimensions> VectorTypeFor<dimensions, Int> maxTextureSize();
template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>(); template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>();
@ -97,8 +99,9 @@ in shaders.
@ref CubeMapTexture, @ref CubeMapTextureArray, @ref RectangleTexture, @ref CubeMapTexture, @ref CubeMapTextureArray, @ref RectangleTexture,
@ref BufferTexture, @ref MultisampleTexture @ref BufferTexture, @ref MultisampleTexture
@requires_gles30 Extension @es_extension{OES,texture_3D} for 3D textures in @requires_gles30 Extension @es_extension{OES,texture_3D} for 3D textures in
OpenGL ES 2.0 OpenGL ES 2.0.
@requires_gl 1D textures are not available in OpenGL ES, only 2D and 3D ones. @requires_webgl20 3D textures are not available in WebGL 1.0.
@requires_gl 1D textures are not available in OpenGL ES or WebGL.
*/ */
template<UnsignedInt dimensions> class Texture: public AbstractTexture { template<UnsignedInt dimensions> class Texture: public AbstractTexture {
public: public:
@ -160,7 +163,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_1D}, * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_1D},
* @def_gl{TEXTURE_2D} or @def_gl{TEXTURE_3D}, eventually * @def_gl{TEXTURE_2D} or @def_gl{TEXTURE_3D}, eventually
@ -190,16 +193,17 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* *
* Taken into account when generating mipmap using @ref generateMipmap() * Taken into account when generating mipmap using @ref generateMipmap()
* and when considering texture completeness when using mipmap * and when considering texture completeness when using mipmap
* filtering. If on OpenGL ES or neither @extension{ARB,direct_state_access} * filtering. If neither @extension{ARB,direct_state_access} (part of
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
* available, the texture is bound before the operation (if not * extension is available, the texture is bound before the operation
* already). Initial value is `0`. * (if not already). Initial value is `0`.
* @see @ref setMaxLevel(), @ref setMinificationFilter(), * @see @ref setMaxLevel(), @ref setMinificationFilter(),
* @fn_gl2{TextureParameter,TexParameter}, * @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_BASE_LEVEL} * @fn_gl{TexParameter} with @def_gl{TEXTURE_BASE_LEVEL}
* @requires_gles30 Base level is always `0` in OpenGL ES 2.0. * @requires_gles30 Base level is always `0` in OpenGL ES 2.0.
* @requires_webgl20 Base level is always `0` in WebGL 1.0.
*/ */
Texture<dimensions>& setBaseLevel(Int level) { Texture<dimensions>& setBaseLevel(Int level) {
AbstractTexture::setBaseLevel(level); AbstractTexture::setBaseLevel(level);
@ -207,17 +211,18 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* @brief Set max mip level * @brief Set max mip level
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Taken into account when generating mipmap using @ref generateMipmap() * Taken into account when generating mipmap using @ref generateMipmap()
* and when considering texture completeness when using mipmap * and when considering texture completeness when using mipmap
* filtering. If on OpenGL ES or neither @extension{ARB,direct_state_access} * filtering. If neither @extension{ARB,direct_state_access} (part of
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
* available, the texture is bound before the operation (if not * extension is available, the texture is bound before the operation
* already). Initial value is `1000`, which is clamped to count of * (if not already). Initial value is `1000`, which is clamped to count
* levels specified when using @ref setStorage(). * of levels specified when using @ref setStorage().
* @see @ref setBaseLevel(), @ref setMinificationFilter(), * @see @ref setBaseLevel(), @ref setMinificationFilter(),
* @fn_gl2{TextureParameter,TexParameter}, * @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
@ -226,11 +231,13 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @requires_gles30 Extension @es_extension{APPLE,texture_max_level}, * @requires_gles30 Extension @es_extension{APPLE,texture_max_level},
* otherwise the max level is always set to largest possible value * otherwise the max level is always set to largest possible value
* in OpenGL ES 2.0. * in OpenGL ES 2.0.
* @requires_webgl20 Always set to largest possible value in WebGL 1.0.
*/ */
Texture<dimensions>& setMaxLevel(Int level) { Texture<dimensions>& setMaxLevel(Int level) {
AbstractTexture::setMaxLevel(level); AbstractTexture::setMaxLevel(level);
return *this; return *this;
} }
#endif
/** /**
* @brief Set minification filter * @brief Set minification filter
@ -241,10 +248,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Sets filter used when the object pixel size is smaller than the * Sets filter used when the object pixel size is smaller than the
* texture size. If on OpenGL ES or neither @extension{ARB,direct_state_access} * texture size. If neither @extension{ARB,direct_state_access} (part
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * of OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
* available, the texture is bound before the operation (if not * extension is available, the texture is bound before the operation
* already). Initial value is {@ref Sampler::Filter::Nearest, * (if not already). Initial value is {@ref Sampler::Filter::Nearest,
* @ref Sampler::Mipmap::Linear}. * @ref Sampler::Mipmap::Linear}.
* @see @ref setMagnificationFilter(), @ref setBaseLevel(), * @see @ref setMagnificationFilter(), @ref setBaseLevel(),
* @ref setMaxLevel(), @fn_gl2{TextureParameter,TexParameter}, * @ref setMaxLevel(), @fn_gl2{TextureParameter,TexParameter},
@ -263,10 +270,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Sets filter used when the object pixel size is larger than largest * Sets filter used when the object pixel size is larger than largest
* texture size. If on OpenGL ES or neither @extension{ARB,direct_state_access} * texture size. If neither @extension{ARB,direct_state_access} (part
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * of OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
* available, the texture is bound before the operation (if not * extension is available, the texture is bound before the operation
* already). Initial value is @ref Sampler::Filter::Linear. * (if not already). Initial value is @ref Sampler::Filter::Linear.
* @see @ref setMinificationFilter(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setMinificationFilter(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -282,17 +289,19 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @brief Set minimum level-of-detail parameter * @brief Set minimum level-of-detail parameter
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Limits selection of highest resolution mipmap. If on OpenGL ES or * Limits selection of highest resolution mipmap. If neither
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). Initial value is * the texture is bound before the operation (if not already). Initial
* `-1000.0f`. * value is `-1000.0f`.
* @see @ref setMaxLod(), @ref setLodBias(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setMaxLod(), @ref setLodBias(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_MIN_LOD} * @fn_gl{TexParameter} with @def_gl{TEXTURE_MIN_LOD}
* @requires_gles30 Texture LOD parameters are not available in OpenGL * @requires_gles30 Texture LOD parameters are not available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Texture LOD parameters are not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setMinLod(Float lod) { Texture<dimensions>& setMinLod(Float lod) {
AbstractTexture::setMinLod(lod); AbstractTexture::setMinLod(lod);
@ -303,17 +312,19 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @brief Set maximum level-of-detail parameter * @brief Set maximum level-of-detail parameter
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Limits selection of lowest resolution mipmap. If on OpenGL ES or * Limits selection of lowest resolution mipmap. If neither
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). Initial value is * the texture is bound before the operation (if not already). Initial
* `1000.0f`. * value is `1000.0f`.
* @see @ref setMinLod(), @ref setLodBias(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setMinLod(), @ref setLodBias(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_MAX_LOD} * @fn_gl{TexParameter} with @def_gl{TEXTURE_MAX_LOD}
* @requires_gles30 Texture LOD parameters are not available in OpenGL * @requires_gles30 Texture LOD parameters are not available in OpenGL
* ES 2.0. * ES 2.0.
* @requires_webgl20 Texture LOD parameters are not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setMaxLod(Float lod) { Texture<dimensions>& setMaxLod(Float lod) {
AbstractTexture::setMaxLod(lod); AbstractTexture::setMaxLod(lod);
@ -337,7 +348,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_LOD_BIAS} * @fn_gl{TexParameter} with @def_gl{TEXTURE_LOD_BIAS}
* @requires_gl Texture LOD bias can be specified only directly in * @requires_gl Texture LOD bias can be specified only directly in
* fragment shader in OpenGL ES. * fragment shader in OpenGL ES and WebGL.
*/ */
Texture<dimensions>& setLodBias(Float bias) { Texture<dimensions>& setLodBias(Float bias) {
AbstractTexture::setLodBias(bias); AbstractTexture::setLodBias(bias);
@ -351,10 +362,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Sets wrapping type for coordinates out of range @f$ [ 0.0, 1.0 ] @f$. * Sets wrapping type for coordinates out of range @f$ [ 0.0, 1.0 ] @f$.
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). Initial * available, the texture is bound before the operation (if not
* value is @ref Sampler::Wrapping::Repeat. * already). Initial value is @ref Sampler::Wrapping::Repeat.
* @see @ref setBorderColor(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setBorderColor(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -366,25 +377,28 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @brief Set border color * @brief Set border color
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Border color when wrapping is set to @ref Sampler::Wrapping::ClampToBorder. * Border color when wrapping is set to @ref Sampler::Wrapping::ClampToBorder.
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} is available, the texture is
* the texture is bound before the operation (if not already). Initial * bound before the operation (if not already). Initial value is
* value is `{0.0f, 0.0f, 0.0f, 0.0f}`. * `{0.0f, 0.0f, 0.0f, 0.0f}`.
* @see @ref setWrapping(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setWrapping(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR} * @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Color4& color) { Texture<dimensions>& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -402,8 +416,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR} * @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Vector4ui& color) { Texture<dimensions>& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -412,8 +426,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Vector4i& color) { Texture<dimensions>& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -428,10 +442,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* Default value is `1.0f`, which means no anisotropy. Set to value * Default value is `1.0f`, which means no anisotropy. Set to value
* greater than `1.0f` for anisotropic filtering. If extension * greater than `1.0f` for anisotropic filtering. If extension
* @extension{EXT,texture_filter_anisotropic} (desktop or ES) is not * @extension{EXT,texture_filter_anisotropic} (desktop or ES) is not
* available, this function does nothing. If on OpenGL ES or neither * available, this function does nothing. If neither
* @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). * the texture is bound before the operation (if not already).
* @see @ref Sampler::maxMaxAnisotropy(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref Sampler::maxMaxAnisotropy(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -442,15 +456,16 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @brief Set sRGB decoding * @brief Set sRGB decoding
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Disables or reenables decoding of sRGB values. If on OpenGL ES or * Disables or reenables decoding of sRGB values. If neither
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). Initial value is * the texture is bound before the operation (if not already). Initial
* `true`. * value is `true`.
* @see @fn_gl2{TextureParameter,TexParameter}, * @see @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -459,13 +474,15 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @requires_es_extension OpenGL ES 3.0 or extension * @requires_es_extension OpenGL ES 3.0 or extension
* @es_extension{EXT,sRGB} and * @es_extension{EXT,sRGB} and
* @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} * @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode}
* @requires_gles SRGB decode is not available in WebGL.
*/ */
Texture<dimensions>& setSRGBDecode(bool decode) { Texture<dimensions>& setSRGBDecode(bool decode) {
AbstractTexture::setSRGBDecode(decode); AbstractTexture::setSRGBDecode(decode);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Set component swizzle * @brief Set component swizzle
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -476,10 +493,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @code * @code
* texture.setSwizzle<'b', 'g', 'r', '0'>(); * texture.setSwizzle<'b', 'g', 'r', '0'>();
* @endcode * @endcode
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). Initial * available, the texture is bound before the operation (if not
* value is `rgba`. * already). Initial value is `rgba`.
* @see @fn_gl2{TextureParameter,TexParameter}, * @see @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -489,6 +506,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* separately in OpenGL ES) * separately in OpenGL ES)
* @requires_gl33 Extension @extension{ARB,texture_swizzle} * @requires_gl33 Extension @extension{ARB,texture_swizzle}
* @requires_gles30 Texture swizzle is not available in OpenGL ES 2.0. * @requires_gles30 Texture swizzle is not available in OpenGL ES 2.0.
* @requires_gles Texture swizzle is not available in WebGL.
*/ */
template<char r, char g, char b, char a> Texture<dimensions>& setSwizzle() { template<char r, char g, char b, char a> Texture<dimensions>& setSwizzle() {
AbstractTexture::setSwizzle<r, g, b, a>(); AbstractTexture::setSwizzle<r, g, b, a>();
@ -496,20 +514,24 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/** /**
* @brief Set depth texture comparison mode * @brief Set depth texture comparison mode
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). Initial * available, the texture is bound before the operation (if not
* value is @ref Sampler::CompareMode::None. * already). Initial value is @ref Sampler::CompareMode::None.
* @note Depth textures can be only 1D or 2D. * @note Depth textures can be only 1D or 2D.
* @see @ref setCompareFunction(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setCompareFunction(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_COMPARE_MODE} * @fn_gl{TexParameter} with @def_gl{TEXTURE_COMPARE_MODE}
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} in
* OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setCompareMode(Sampler::CompareMode mode) { Texture<dimensions>& setCompareMode(Sampler::CompareMode mode) {
AbstractTexture::setCompareMode(mode); AbstractTexture::setCompareMode(mode);
@ -521,33 +543,37 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Comparison operator used when comparison mode is set to * Comparison operator used when comparison mode is set to
* @ref Sampler::CompareMode::CompareRefToTexture. If on OpenGL ES or * @ref Sampler::CompareMode::CompareRefToTexture. If neither
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). Initial value is * the texture is bound before the operation (if not already). Initial
* @ref Sampler::CompareFunction::LessOrEqual. * value is @ref Sampler::CompareFunction::LessOrEqual.
* @note Depth textures can be only 1D or 2D. * @note Depth textures can be only 1D or 2D.
* @see @ref setCompareMode(), @fn_gl2{TextureParameter,TexParameter}, * @see @ref setCompareMode(), @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_COMPARE_FUNC} * @fn_gl{TexParameter} with @def_gl{TEXTURE_COMPARE_FUNC}
* @requires_gles30 Extension @es_extension{EXT,shadow_samplers} * @requires_gles30 Extension @es_extension{EXT,shadow_samplers} in
* OpenGL ES 2.0.
* @requires_webgl20 Depth texture comparison is not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setCompareFunction(Sampler::CompareFunction function) { Texture<dimensions>& setCompareFunction(Sampler::CompareFunction function) {
AbstractTexture::setCompareFunction(function); AbstractTexture::setCompareFunction(function);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Set depth/stencil texture mode * @brief Set depth/stencil texture mode
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Selects which component of packed depth/stencil texture is used for * Selects which component of packed depth/stencil texture is used for
* texturing. If on OpenGL ES or neither @extension{ARB,direct_state_access} * texturing. If neither @extension{ARB,direct_state_access} (part of
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* available, the texture is bound before the operation (if not * the texture is bound before the operation (if not already). Initial
* already). Initial value is @ref Sampler::DepthStencilMode::DepthComponent. * value is @ref Sampler::DepthStencilMode::DepthComponent.
* @note Depth textures can be only 1D or 2D. * @note Depth textures can be only 1D or 2D.
* @see @fn_gl2{TextureParameter,TexParameter}, * @see @fn_gl2{TextureParameter,TexParameter},
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
@ -556,6 +582,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @requires_gl43 Extension @extension{ARB,stencil_texturing} * @requires_gl43 Extension @extension{ARB,stencil_texturing}
* @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0
* and older. * and older.
* @requires_gles Stencil texturing is not available in WebGL.
*/ */
Texture<dimensions>& setDepthStencilMode(Sampler::DepthStencilMode mode) { Texture<dimensions>& setDepthStencilMode(Sampler::DepthStencilMode mode) {
AbstractTexture::setDepthStencilMode(mode); AbstractTexture::setDepthStencilMode(mode);
@ -573,8 +600,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* After calling this function the texture is immutable and calling * After calling this function the texture is immutable and calling
* @ref setStorage() or @ref setImage() is not allowed. * @ref setStorage() or @ref setImage() is not allowed.
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is * nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not * available, the texture is bound before the operation (if not
* already). If neither @extension{ARB,texture_storage} (part of OpenGL * already). If neither @extension{ARB,texture_storage} (part of OpenGL
* 4.2), OpenGL ES 3.0 nor @es_extension{EXT,texture_storage} in OpenGL * 4.2), OpenGL ES 3.0 nor @es_extension{EXT,texture_storage} in OpenGL
@ -599,10 +626,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** /**
* @brief Image size in given mip level * @brief Image size in given mip level
* *
* The result is not cached in any way. If on OpenGL ES or neither * The result is not cached in any way. If neither
* @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor * @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the texture is * @extension{EXT,direct_state_access} desktop extension is available,
* bound before the operation (if not already). * the texture is bound before the operation (if not already).
* @see @ref image(), @fn_gl2{GetTextureLevelParameter,GetTexLevelParameter}, * @see @ref image(), @fn_gl2{GetTextureLevelParameter,GetTexLevelParameter},
* @fn_gl_extension{GetTextureLevelParameter,EXT,direct_state_access}, * @fn_gl_extension{GetTextureLevelParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -610,6 +637,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @def_gl{TEXTURE_HEIGHT}, @def_gl{TEXTURE_DEPTH} * @def_gl{TEXTURE_HEIGHT}, @def_gl{TEXTURE_DEPTH}
* @requires_gles31 Texture image size queries are not available in * @requires_gles31 Texture image size queries are not available in
* OpenGL ES 3.0 and older. * OpenGL ES 3.0 and older.
* @requires_gles Texture image size queries are not available in
* WebGL.
*/ */
VectorTypeFor<dimensions, Int> imageSize(Int level) { VectorTypeFor<dimensions, Int> imageSize(Int level) {
return DataHelper<dimensions>::imageSize(*this, level); return DataHelper<dimensions>::imageSize(*this, level);
@ -643,8 +672,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{GetnTexImage,ARB,robustness}, * @fn_gl_extension{GetnTexImage,ARB,robustness},
* @fn_gl_extension{GetTextureImage,EXT,direct_state_access}, * @fn_gl_extension{GetTextureImage,EXT,direct_state_access},
* eventually @fn_gl{GetTexImage} * eventually @fn_gl{GetTexImage}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Int level, Image<dimensions>& image) { void image(Int level, Image<dimensions>& image) {
AbstractTexture::image<dimensions>(level, image); AbstractTexture::image<dimensions>(level, image);
@ -666,8 +695,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @param usage Buffer usage * @param usage Buffer usage
* *
* See @ref image(Int, Image&) for more information. * See @ref image(Int, Image&) for more information.
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
* @todo Make it more flexible (usable with * @todo Make it more flexible (usable with
* @extension{ARB,buffer_storage}, avoiding relocations...) * @extension{ARB,buffer_storage}, avoiding relocations...)
*/ */
@ -694,8 +723,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* given image. * given image.
* @see @fn_gl{GetTextureSubImage} * @see @fn_gl{GetTextureSubImage}
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>& image) { void subImage(Int level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>& image) {
AbstractTexture::subImage<dimensions>(level, range, image); AbstractTexture::subImage<dimensions>(level, range, image);
@ -720,8 +749,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* See @ref subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&) * See @ref subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
* for more information. * for more information.
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>& image, BufferUsage usage) { void subImage(Int level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>& image, BufferUsage usage) {
AbstractTexture::subImage<dimensions>(level, range, image, usage); AbstractTexture::subImage<dimensions>(level, range, image, usage);
@ -764,6 +793,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage() * @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead. * instead.
*/ */
@ -775,6 +806,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage() * @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead. * instead.
*/ */
@ -791,15 +824,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @ref Trade::ImageData of the same dimension count * @ref Trade::ImageData of the same dimension count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). * available, the texture is bound before the operation (if not
* * already).
* @attention In @ref MAGNUM_TARGET_WEBGL "WebGL" the @ref ColorType of
* data passed in @p image must match the original one specified
* in @ref setImage(). It means that you might not be able to use
* @ref setStorage() as it uses implicit @ref ColorType value.
*
* @see @ref setStorage(), @fn_gl2{TextureSubImage1D,TexSubImage1D} / * @see @ref setStorage(), @fn_gl2{TextureSubImage1D,TexSubImage1D} /
* @fn_gl2{TextureSubImage2D,TexSubImage2D} / @fn_gl2{TextureSubImage3D,TexSubImage3D}, * @fn_gl2{TextureSubImage2D,TexSubImage2D} / @fn_gl2{TextureSubImage3D,TexSubImage3D},
* @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access} / * @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access} /
@ -807,6 +835,11 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access}, * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexSubImage1D} / @fn_gl{TexSubImage2D} / @fn_gl{TexSubImage3D} * @fn_gl{TexSubImage1D} / @fn_gl{TexSubImage2D} / @fn_gl{TexSubImage3D}
* @requires_gles In @ref MAGNUM_TARGET_WEBGL "WebGL" the @ref ColorType
* of data passed in @p image must match the original one
* specified in @ref setImage(). It means that you might not be
* able to use @ref setStorage() as it uses implicit @ref ColorType
* value.
*/ */
Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, const ImageReference<dimensions>& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, const ImageReference<dimensions>& image) {
DataHelper<Dimensions>::setSubImage(*this, level, offset, image); DataHelper<Dimensions>::setSubImage(*this, level, offset, image);
@ -817,6 +850,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>& image) {
DataHelper<Dimensions>::setSubImage(*this, level, offset, image); DataHelper<Dimensions>::setSubImage(*this, level, offset, image);
@ -826,6 +861,8 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES * @requires_gles30 Pixel buffer objects are not available in OpenGL ES
* 2.0. * 2.0.
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/ */
Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>&& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>&& image) {
return setSubImage(level, offset, image); return setSubImage(level, offset, image);
@ -836,9 +873,10 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @brief Generate mipmap * @brief Generate mipmap
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). * available, the texture is bound before the operation (if not
* already).
* @see @ref setMinificationFilter(), @fn_gl2{GenerateTextureMipmap,GenerateMipmap}, * @see @ref setMinificationFilter(), @fn_gl2{GenerateTextureMipmap,GenerateMipmap},
* @fn_gl_extension{GenerateTextureMipmap,EXT,direct_state_access}, * @fn_gl_extension{GenerateTextureMipmap,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
@ -891,7 +929,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** /**
@brief One-dimensional texture @brief One-dimensional texture
@requires_gl Only 2D and 3D textures are available in OpenGL ES. @requires_gl Only 2D and 3D textures are available in OpenGL ES and WebGL.
*/ */
typedef Texture<1> Texture1D; typedef Texture<1> Texture1D;
#endif #endif
@ -903,6 +941,7 @@ typedef Texture<2> Texture2D;
@brief Three-dimensional texture @brief Three-dimensional texture
@requires_gles30 Extension @es_extension{OES,texture_3D} in OpenGL ES 2.0 @requires_gles30 Extension @es_extension{OES,texture_3D} in OpenGL ES 2.0
@requires_webgl20 3D textures are not available in WebGL 1.0.
*/ */
typedef Texture<3> Texture3D; typedef Texture<3> Texture3D;

55
src/Magnum/TextureArray.h

@ -89,7 +89,9 @@ documentation for more information about usage in shaders.
@ref BufferTexture, @ref MultisampleTexture @ref BufferTexture, @ref MultisampleTexture
@requires_gl30 Extension @extension{EXT,texture_array} @requires_gl30 Extension @extension{EXT,texture_array}
@requires_gles30 Array textures are not available in OpenGL ES 2.0. @requires_gles30 Array textures are not available in OpenGL ES 2.0.
@requires_gl 1D array textures are not available in OpenGL ES, only 2D ones. @requires_webgl20 Array textures are not available in WebGL 1.0.
@requires_gl 1D array textures are not available in OpenGL ES or WebGL, only
2D ones.
@todo Fix this when @es_extension{NV,texture_array} is in ES2 extension headers @todo Fix this when @es_extension{NV,texture_array} is in ES2 extension headers
*/ */
template<UnsignedInt dimensions> class TextureArray: public AbstractTexture { template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
@ -111,7 +113,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access} * Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) is not supported, the texture is created on * (part of OpenGL 4.5) is not available, the texture is created on
* first use. * first use.
* @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_1D_ARRAY} or * @see @fn_gl{CreateTextures} with @def_gl{TEXTURE_1D_ARRAY} or
* @def_gl{TEXTURE_2D_ARRAY}, eventually @fn_gl{GenTextures} * @def_gl{TEXTURE_2D_ARRAY}, eventually @fn_gl{GenTextures}
@ -191,7 +193,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* *
* See @ref Texture::setLodBias() for more information. * See @ref Texture::setLodBias() for more information.
* @requires_gl Texture LOD bias can be specified only directly in * @requires_gl Texture LOD bias can be specified only directly in
* fragment shader in OpenGL ES. * fragment shader in OpenGL ES and WebGL.
*/ */
TextureArray<dimensions>& setLodBias(Float bias) { TextureArray<dimensions>& setLodBias(Float bias) {
AbstractTexture::setLodBias(bias); AbstractTexture::setLodBias(bias);
@ -210,6 +212,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::setBorderColor(const Color4&) * @copybrief Texture::setBorderColor(const Color4&)
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -217,11 +220,13 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::setBorderColor(const Color4&) for more * See @ref Texture::setBorderColor(const Color4&) for more
* information. * information.
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Color4& color) { TextureArray<dimensions>& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -231,8 +236,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::setBorderColor(const Vector4ui&) for more * See @ref Texture::setBorderColor(const Vector4ui&) for more
* information. * information.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Vector4ui& color) { TextureArray<dimensions>& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -241,8 +246,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border is available only for float textures in OpenGL * @requires_gl Border clamp is available only for float textures in
* ES. * OpenGL ES. Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Vector4i& color) { TextureArray<dimensions>& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -261,6 +266,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::setSRGBDecode() * @copybrief Texture::setSRGBDecode()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -268,6 +274,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::setSRGBDecode() for more information. * See @ref Texture::setSRGBDecode() for more information.
* @requires_extension Extension @extension{EXT,texture_sRGB_decode} * @requires_extension Extension @extension{EXT,texture_sRGB_decode}
* @requires_es_extension Extension @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} * @requires_es_extension Extension @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode}
* @requires_gles SRGB decode is not available in WebGL.
*/ */
TextureArray<dimensions>& setSRGBDecode(bool decode) { TextureArray<dimensions>& setSRGBDecode(bool decode) {
AbstractTexture::setSRGBDecode(decode); AbstractTexture::setSRGBDecode(decode);
@ -285,6 +292,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
AbstractTexture::setSwizzle<r, g, b, a>(); AbstractTexture::setSwizzle<r, g, b, a>();
return *this; return *this;
} }
#endif
/** /**
* @copybrief Texture::setCompareMode() * @copybrief Texture::setCompareMode()
@ -308,6 +316,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::setDepthStencilMode() * @copybrief Texture::setDepthStencilMode()
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -316,11 +325,13 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @requires_gl43 Extension @extension{ARB,stencil_texturing} * @requires_gl43 Extension @extension{ARB,stencil_texturing}
* @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0 * @requires_gles31 Stencil texturing is not available in OpenGL ES 3.0
* and older. * and older.
* @requires_gles Stencil texturing is not available in WebGL.
*/ */
TextureArray<dimensions>& setDepthStencilMode(Sampler::DepthStencilMode mode) { TextureArray<dimensions>& setDepthStencilMode(Sampler::DepthStencilMode mode) {
AbstractTexture::setDepthStencilMode(mode); AbstractTexture::setDepthStencilMode(mode);
return *this; return *this;
} }
#endif
/** /**
* @copybrief Texture::setStorage() * @copybrief Texture::setStorage()
@ -334,16 +345,20 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_WEBGL
/** /**
* @copybrief Texture::imageSize() * @copybrief Texture::imageSize()
* *
* See @ref Texture::imageSize() for more information. * See @ref Texture::imageSize() for more information.
* @requires_gles31 Texture image size queries are not available in * @requires_gles31 Texture image size queries are not available in
* OpenGL ES 3.0 and older. * OpenGL ES 3.0 and older.
* @requires_gles Texture image size queries are not available in
* WebGL.
*/ */
VectorTypeFor<dimensions+1, Int> imageSize(Int level) { VectorTypeFor<dimensions+1, Int> imageSize(Int level) {
return DataHelper<dimensions+1>::imageSize(*this, level); return DataHelper<dimensions+1>::imageSize(*this, level);
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -351,8 +366,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* See @ref Texture::image(Int, Image&) for more information. * See @ref Texture::image(Int, Image&) for more information.
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Int level, Image<dimensions+1>& image) { void image(Int level, Image<dimensions+1>& image) {
AbstractTexture::image<dimensions+1>(level, image); AbstractTexture::image<dimensions+1>(level, image);
@ -373,8 +388,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* *
* See @ref Texture::image(Int, BufferImage&, BufferUsage) for more * See @ref Texture::image(Int, BufferImage&, BufferUsage) for more
* information. * information.
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void image(Int level, BufferImage<dimensions+1>& image, BufferUsage usage) { void image(Int level, BufferImage<dimensions+1>& image, BufferUsage usage) {
AbstractTexture::image<dimensions+1>(level, image, usage); AbstractTexture::image<dimensions+1>(level, image, usage);
@ -395,8 +410,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&) * See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
* for more information. * for more information.
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>& image) { void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>& image) {
AbstractTexture::subImage<dimensions+1>(level, range, image); AbstractTexture::subImage<dimensions+1>(level, range, image);
@ -417,8 +432,8 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage) * See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage)
* for more information. * for more information.
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image} * @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
* @requires_gl Texture image queries are not available in OpenGL ES. * @requires_gl Texture image queries are not available in OpenGL ES or
* See @ref Framebuffer::read() for possible workaround. * WebGL. See @ref Framebuffer::read() for possible workaround.
*/ */
void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>& image, BufferUsage usage) { void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>& image, BufferUsage usage) {
AbstractTexture::subImage<dimensions+1>(level, range, image, usage); AbstractTexture::subImage<dimensions+1>(level, range, image, usage);
@ -473,9 +488,10 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @ref Trade::ImageData of the same dimension count * @ref Trade::ImageData of the same dimension count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part * If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available, * nor @extension{EXT,direct_state_access} desktop extension is
* the texture is bound before the operation (if not already). * available, the texture is bound before the operation (if not
* already).
* @see @ref setStorage(), @fn_gl2{TextureSubImage2D,TexSubImage2D}/ * @see @ref setStorage(), @fn_gl2{TextureSubImage2D,TexSubImage2D}/
* @fn_gl2{TextureSubImage3D,TexSubImage3D}, * @fn_gl2{TextureSubImage3D,TexSubImage3D},
* @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/
@ -547,7 +563,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
@brief One-dimensional texture array @brief One-dimensional texture array
@requires_gl30 Extension @extension{EXT,texture_array} @requires_gl30 Extension @extension{EXT,texture_array}
@requires_gl Only @ref Texture2DArray is available in OpenGL ES. @requires_gl Only @ref Texture2DArray is available in OpenGL ES and WebGL.
*/ */
typedef TextureArray<1> Texture1DArray; typedef TextureArray<1> Texture1DArray;
#endif #endif
@ -557,6 +573,7 @@ typedef TextureArray<1> Texture1DArray;
@requires_gl30 Extension @extension{EXT,texture_array} @requires_gl30 Extension @extension{EXT,texture_array}
@requires_gles30 Array textures are not available in OpenGL ES 2.0. @requires_gles30 Array textures are not available in OpenGL ES 2.0.
@requires_webgl20 Array textures are not available in WebGL 1.0.
*/ */
typedef TextureArray<2> Texture2DArray; typedef TextureArray<2> Texture2DArray;

Loading…
Cancel
Save