mirror of https://github.com/mosra/magnum.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
835 lines
46 KiB
835 lines
46 KiB
|
8 years ago
|
#ifndef Magnum_GL_AbstractTexture_h
|
||
|
|
#define Magnum_GL_AbstractTexture_h
|
||
|
15 years ago
|
/*
|
||
|
|
This file is part of Magnum.
|
||
|
|
|
||
|
8 years ago
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||
|
12 years ago
|
Vladimír Vondruš <mosra@centrum.cz>
|
||
|
13 years ago
|
|
||
|
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
|
copy of this software and associated documentation files (the "Software"),
|
||
|
|
to deal in the Software without restriction, including without limitation
|
||
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||
|
|
and/or sell copies of the Software, and to permit persons to whom the
|
||
|
|
Software is furnished to do so, subject to the following conditions:
|
||
|
|
|
||
|
|
The above copyright notice and this permission notice shall be included
|
||
|
|
in all copies or substantial portions of the Software.
|
||
|
|
|
||
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||
|
|
DEALINGS IN THE SOFTWARE.
|
||
|
15 years ago
|
*/
|
||
|
|
|
||
|
|
/** @file
|
||
|
13 years ago
|
* @brief Class @ref Magnum::AbstractTexture
|
||
|
15 years ago
|
*/
|
||
|
|
|
||
|
11 years ago
|
#include <Corrade/Containers/ArrayView.h>
|
||
|
12 years ago
|
|
||
|
11 years ago
|
#include "Magnum/DimensionTraits.h"
|
||
|
11 years ago
|
#include "Magnum/Tags.h"
|
||
|
8 years ago
|
#include "Magnum/GL/AbstractObject.h"
|
||
|
|
#include "Magnum/GL/GL.h"
|
||
|
|
#include "Magnum/GL/Sampler.h"
|
||
|
15 years ago
|
|
||
|
|
namespace Magnum {
|
||
|
|
|
||
|
12 years ago
|
namespace Implementation {
|
||
|
|
struct TextureState;
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
template<char> struct TextureSwizzle;
|
||
|
|
template<> struct TextureSwizzle<'r'> { enum: GLint { Value = GL_RED }; };
|
||
|
|
template<> struct TextureSwizzle<'g'> { enum: GLint { Value = GL_GREEN }; };
|
||
|
|
template<> struct TextureSwizzle<'b'> { enum: GLint { Value = GL_BLUE }; };
|
||
|
|
template<> struct TextureSwizzle<'a'> { enum: GLint { Value = GL_ALPHA }; };
|
||
|
|
template<> struct TextureSwizzle<'0'> { enum: GLint { Value = GL_ZERO }; };
|
||
|
|
template<> struct TextureSwizzle<'1'> { enum: GLint { Value = GL_ONE }; };
|
||
|
|
#endif
|
||
|
|
}
|
||
|
12 years ago
|
|
||
|
14 years ago
|
/**
|
||
|
14 years ago
|
@brief Base for textures
|
||
|
|
|
||
|
12 years ago
|
Encapsulates one OpenGL texture object. See @ref Texture, @ref TextureArray,
|
||
|
|
@ref CubeMapTexture, @ref CubeMapTextureArray, @ref RectangleTexture,
|
||
|
|
@ref BufferTexture and @ref MultisampleTexture documentation for more
|
||
|
|
information and usage examples.
|
||
|
14 years ago
|
|
||
|
8 years ago
|
@section AbstractTexture-webgl-restrictions WebGL restrictions
|
||
|
12 years ago
|
|
||
|
|
@ref MAGNUM_TARGET_WEBGL "WebGL" puts some restrictions on type of data
|
||
|
|
submitted to @ref Texture::setSubImage() "*Texture::setSubImage()", see its
|
||
|
|
documentation for details.
|
||
|
|
|
||
|
8 years ago
|
@section AbstractTexture-performance-optimization Performance optimizations and security
|
||
|
14 years ago
|
|
||
|
10 years ago
|
The engine tracks currently bound textures and images in all available texture
|
||
|
8 years ago
|
units to avoid unnecessary calls to @fn_gl_keyword{ActiveTexture},
|
||
|
|
@fn_gl_keyword{BindTexture} and @fn_gl_keyword{BindImageTexture}. Texture
|
||
|
|
configuration functions use dedicated highest available texture unit to not
|
||
|
|
affect active bindings in user units. Texture limits and implementation-defined
|
||
|
|
values (such as @ref maxColorSamples()) are cached, so repeated queries don't
|
||
|
|
result in repeated @fn_gl{Get} calls. See also @ref Context::resetState() and
|
||
|
|
@ref Context::State::Textures.
|
||
|
14 years ago
|
|
||
|
11 years ago
|
If @extension{ARB,direct_state_access} (part of OpenGL 4.5) is available,
|
||
|
|
@ref bind(Int) and @ref unbind(Int) use @fn_gl{BindTextureUnit}. Otherwise, if
|
||
|
|
@extension{ARB,multi_bind} (part of OpenGL 4.4) is available, @ref bind(Int)
|
||
|
|
and @ref unbind() uses @fn_gl{BindTextures}. Lastly, if
|
||
|
|
@extension{EXT,direct_state_access} desktop extension is available,
|
||
|
|
@fn_gl_extension{BindNamedTexture,EXT,direct_state_access} function is used to
|
||
|
|
avoid unnecessary calls to @fn_gl{ActiveTexture}.
|
||
|
12 years ago
|
|
||
|
|
In addition, if either @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
11 years ago
|
or @extension{EXT,direct_state_access} desktop extension is available, also all
|
||
|
|
texture configuration and data updating functions use DSA functions to avoid
|
||
|
12 years ago
|
unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}. See
|
||
|
|
respective function documentation for more information.
|
||
|
|
|
||
|
|
If @extension{ARB,multi_bind} (part of OpenGL 4.5) is available,
|
||
|
|
@ref bind(Int, std::initializer_list<AbstractTexture*>) and @ref unbind(Int, std::size_t)
|
||
|
|
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)
|
||
|
|
calls.
|
||
|
|
|
||
|
11 years ago
|
If either @extension{ARB,direct_state_access} (part of OpenGL 4.5) or
|
||
|
|
@extension{ARB,robustness} desktop extension is available, image reading
|
||
|
|
operations (such as @ref Texture::image()) are protected from buffer overflow.
|
||
|
|
However, if @extension{ARB,direct_state_access} is not available and both
|
||
|
|
@extension{EXT,direct_state_access} and @extension{ARB,robustness} are
|
||
|
|
available, the robust version is preferred over DSA.
|
||
|
13 years ago
|
|
||
|
14 years ago
|
To achieve least state changes, fully configure each texture in one run --
|
||
|
8 years ago
|
method chaining comes in handy --- and try to have often used textures in
|
||
|
12 years ago
|
dedicated units, not occupied by other textures. First configure the texture
|
||
|
14 years ago
|
and *then* set the data, so OpenGL can optimize them to match the settings. To
|
||
|
|
avoid redundant consistency checks and memory reallocations when updating
|
||
|
|
texture data, set texture storage at once using @ref Texture::setStorage() "setStorage()"
|
||
|
|
and then set data using @ref Texture::setSubImage() "setSubImage()".
|
||
|
14 years ago
|
|
||
|
13 years ago
|
Function @ref Texture::setStorage() "setStorage()" creates immutable texture
|
||
|
|
storage, removing the need for additional consistency checks and memory
|
||
|
|
reallocations when updating the data later. If OpenGL 4.2, @extension{ARB,texture_storage},
|
||
|
9 years ago
|
OpenGL ES 3.0 or @extension{EXT,texture_storage} in OpenGL ES 2.0 is not
|
||
|
13 years ago
|
available, the feature is emulated with sequence of @ref Texture::setImage() "setImage()"
|
||
|
|
calls.
|
||
|
|
|
||
|
12 years ago
|
You can use functions @ref Texture::invalidateImage() "invalidateImage()" and
|
||
|
13 years ago
|
@ref Texture::invalidateSubImage() "invalidateSubImage()" if you don't need
|
||
|
|
texture data anymore to avoid unnecessary memory operations performed by OpenGL
|
||
|
|
in order to preserve the data. If running on OpenGL ES or extension
|
||
|
12 years ago
|
@extension{ARB,invalidate_subdata} (part of OpenGL 4.3) is not available, these
|
||
|
|
functions do nothing.
|
||
|
14 years ago
|
|
||
|
13 years ago
|
@todo all texture [level] parameters, global texture parameters
|
||
|
14 years ago
|
@todo Texture copying
|
||
|
13 years ago
|
@todo `GL_MAX_SAMPLE_MASK_WORDS` when @extension{ARB,texture_multisample} is done
|
||
|
12 years ago
|
@todo Query for immutable levels (@extension{ARB,ES3_compatibility})
|
||
|
15 years ago
|
*/
|
||
|
8 years ago
|
class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
|
||
|
12 years ago
|
friend Implementation::TextureState;
|
||
|
10 years ago
|
friend AbstractFramebuffer;
|
||
|
12 years ago
|
friend CubeMapTexture;
|
||
|
14 years ago
|
|
||
|
15 years ago
|
public:
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
/**
|
||
|
|
* @brief Max level-of-detail bias
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
|
* OpenGL calls.
|
||
|
8 years ago
|
* @see @fn_gl{Get} with @def_gl_keyword{MAX_TEXTURE_LOD_BIAS}
|
||
|
12 years ago
|
* @requires_gles30 Texture LOD bias doesn't have
|
||
|
12 years ago
|
* implementation-defined range in OpenGL ES 2.0.
|
||
|
11 years ago
|
* @requires_webgl20 Texture LOD bias doesn't have
|
||
|
|
* implementation-defined range in WebGL 1.0.
|
||
|
12 years ago
|
*/
|
||
|
|
static Float maxLodBias();
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
13 years ago
|
/**
|
||
|
|
* @brief Max supported color sample count
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
12 years ago
|
* OpenGL calls. If neither extension @extension{ARB,texture_multisample}
|
||
|
8 years ago
|
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns
|
||
|
|
* @cpp 0 @ce.
|
||
|
|
* @see @fn_gl{Get} with @def_gl_keyword{MAX_COLOR_TEXTURE_SAMPLES}
|
||
|
11 years ago
|
* @requires_gles30 Not defined in OpenGL ES 2.0.
|
||
|
|
* @requires_gles Multisample textures are not available in WebGL.
|
||
|
13 years ago
|
*/
|
||
|
|
static Int maxColorSamples();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Max supported depth sample count
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
12 years ago
|
* OpenGL calls. If neither extension @extension{ARB,texture_multisample}
|
||
|
8 years ago
|
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns
|
||
|
|
* @cpp 0 @ce.
|
||
|
|
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEPTH_TEXTURE_SAMPLES}
|
||
|
11 years ago
|
* @requires_gles30 Not defined in OpenGL ES 2.0.
|
||
|
|
* @requires_gles Multisample textures are not available in WebGL.
|
||
|
13 years ago
|
*/
|
||
|
|
static Int maxDepthSamples();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Max supported integer sample count
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
12 years ago
|
* OpenGL calls. If neither extension @extension{ARB,texture_multisample}
|
||
|
8 years ago
|
* (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns
|
||
|
|
* @cpp 0 @ce.
|
||
|
|
* @see @fn_gl{Get} with @def_gl_keyword{MAX_INTEGER_SAMPLES}
|
||
|
11 years ago
|
* @requires_gles30 Not defined in OpenGL ES 2.0.
|
||
|
|
* @requires_gles Multisample textures are not available in WebGL.
|
||
|
13 years ago
|
*/
|
||
|
|
static Int maxIntegerSamples();
|
||
|
|
#endif
|
||
|
14 years ago
|
|
||
|
12 years ago
|
/**
|
||
|
|
* @brief Unbind any texture from given texture unit
|
||
|
|
*
|
||
|
11 years ago
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5),
|
||
|
|
* @extension{ARB,multi_bind} (part of OpenGL 4.4) nor
|
||
|
|
* @extension{EXT,direct_state_access} desktop extension is available,
|
||
|
|
* the texture unit is made active before unbinding the texture.
|
||
|
12 years ago
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref bind(), @ref Shader::maxCombinedTextureImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindTextureUnit}, @fn_gl_keyword{BindTextures},
|
||
|
|
* @fn_gl_extension_keyword{BindMultiTexture,EXT,direct_state_access},
|
||
|
|
* eventually @fn_gl_keyword{ActiveTexture} and
|
||
|
|
* @fn_gl_keyword{BindTexture}
|
||
|
12 years ago
|
*/
|
||
|
|
static void unbind(Int textureUnit);
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
|
* @brief Unbind textures in given range of texture units
|
||
|
|
*
|
||
|
10 years ago
|
* Unbinds all textures in the range @f$ [ firstTextureUnit ; firstTextureUnit + count ) @f$.
|
||
|
12 years ago
|
* If @extension{ARB,multi_bind} (part of OpenGL 4.4) is not available,
|
||
|
|
* the feature is emulated with sequence of @ref unbind(Int) calls.
|
||
|
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
10 years ago
|
* @see @ref bind(), @ref Shader::maxCombinedTextureImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindTextures}
|
||
|
12 years ago
|
*/
|
||
|
|
static void unbind(Int firstTextureUnit, std::size_t count);
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
|
* @brief Bind textures to given range of texture units
|
||
|
|
*
|
||
|
|
* Binds first texture in the list to @p firstTextureUnit, second to
|
||
|
8 years ago
|
* `firstTextureUnit + 1` etc. If any texture is @cpp nullptr @ce,
|
||
|
|
* given texture unit is unbound. If @extension{ARB,multi_bind} (part
|
||
|
|
* of OpenGL 4.4) is not available, the feature is emulated with
|
||
|
|
* sequence of @ref bind(Int) / @ref unbind(Int) calls.
|
||
|
12 years ago
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
8 years ago
|
* @see @ref Shader::maxCombinedTextureImageUnits(),
|
||
|
|
* @fn_gl_keyword{BindTextures}
|
||
|
12 years ago
|
*/
|
||
|
|
static void bind(Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures);
|
||
|
|
|
||
|
10 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
/**
|
||
|
|
* @brief Unbind any image from given image unit
|
||
|
|
*
|
||
|
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref Texture::bindImage() "*Texture::bindImage()",
|
||
|
|
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
|
||
|
|
* @ref unbindImages(), @ref bindImages(),
|
||
|
|
* @ref AbstractShaderProgram::maxImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindImageTexture}
|
||
|
10 years ago
|
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
|
||
|
|
* @requires_gles31 Shader image load/store is not available in OpenGL
|
||
|
|
* ES 3.0 and older.
|
||
|
|
* @requires_gles Shader image load/store is not available in WebGL.
|
||
|
|
*/
|
||
|
|
static void unbindImage(Int imageUnit);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Unbind images in given range of image units
|
||
|
|
*
|
||
|
|
* Unbinds all texture in the range @f$ [ firstImageUnit ; firstImageUnit + count ) @f$.
|
||
|
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref Texture::bindImage() "*Texture::bindImage()",
|
||
|
|
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
|
||
|
|
* @ref unbindImage(), @ref bindImages(),
|
||
|
|
* @ref AbstractShaderProgram::maxImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindImageTextures}
|
||
|
10 years ago
|
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
|
||
|
|
* @requires_gl44 Extension @extension{ARB,multi_bind}
|
||
|
|
* @requires_gl Multi bind is not available in OpenGL ES and WebGL.
|
||
|
|
*/
|
||
|
|
static void unbindImages(Int firstImageUnit, std::size_t count) {
|
||
|
|
bindImagesInternal(firstImageUnit, {nullptr, count});
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Bind textures to given range of texture units
|
||
|
|
*
|
||
|
|
* Binds first level of given texture in the list to @p firstImageUnit,
|
||
|
|
* second to `firstTextureUnit + 1` etc. 3D, cube map and array
|
||
|
8 years ago
|
* textures are bound as layered targets. If any texture is
|
||
|
|
* @cpp nullptr @ce, given image unit is unbound.
|
||
|
10 years ago
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref Texture::bindImage() "*Texture::bindImage()",
|
||
|
|
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
|
||
|
|
* @ref unbindImages(), @ref unbindImage(),
|
||
|
|
* @ref AbstractShaderProgram::maxImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindImageTextures}
|
||
|
10 years ago
|
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
|
||
|
|
* @requires_gl44 Extension @extension{ARB,multi_bind}
|
||
|
|
* @requires_gl Multi bind is not available in OpenGL ES and WebGL.
|
||
|
|
*/
|
||
|
|
static void bindImages(Int firstImageUnit, std::initializer_list<AbstractTexture*> textures) {
|
||
|
|
bindImagesInternal(firstImageUnit, {textures.begin(), textures.size()});
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
/** @brief Copying is not allowed */
|
||
|
|
AbstractTexture(const AbstractTexture&) = delete;
|
||
|
|
|
||
|
|
/** @brief Move constructor */
|
||
|
|
AbstractTexture(AbstractTexture&& other) noexcept;
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
|
* @brief Destructor
|
||
|
|
*
|
||
|
|
* Deletes associated OpenGL texture.
|
||
|
11 years ago
|
* @see @ref BufferTexture::wrap(), @ref CubeMapTexture::wrap(),
|
||
|
|
* @ref CubeMapTextureArray::wrap(),
|
||
|
|
* @ref MultisampleTexture::wrap(), @ref RectangleTexture::wrap(),
|
||
|
|
* @ref Texture::wrap(), @ref TextureArray::wrap(),
|
||
|
8 years ago
|
* @ref release(), @fn_gl_keyword{DeleteTextures}
|
||
|
12 years ago
|
*/
|
||
|
|
~AbstractTexture();
|
||
|
|
|
||
|
13 years ago
|
/** @brief Copying is not allowed */
|
||
|
|
AbstractTexture& operator=(const AbstractTexture&) = delete;
|
||
|
|
|
||
|
14 years ago
|
/** @brief Move assignment */
|
||
|
13 years ago
|
AbstractTexture& operator=(AbstractTexture&& other) noexcept;
|
||
|
14 years ago
|
|
||
|
11 years ago
|
/** @brief OpenGL texture ID */
|
||
|
|
GLuint id() const { return _id; }
|
||
|
|
|
||
|
11 years ago
|
/**
|
||
|
|
* @brief Release OpenGL object
|
||
|
|
*
|
||
|
|
* Releases ownership of OpenGL texture object and returns its ID so it
|
||
|
|
* is not deleted on destruction. The internal state is then equivalent
|
||
|
|
* to moved-from state.
|
||
|
|
* @see @ref BufferTexture::wrap(), @ref CubeMapTexture::wrap(),
|
||
|
|
* @ref CubeMapTextureArray::wrap(),
|
||
|
|
* @ref MultisampleTexture::wrap(), @ref RectangleTexture::wrap(),
|
||
|
|
* @ref Texture::wrap(), @ref TextureArray::wrap()
|
||
|
|
*/
|
||
|
|
GLuint release();
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
13 years ago
|
/**
|
||
|
12 years ago
|
* @brief Texture label
|
||
|
13 years ago
|
*
|
||
|
|
* The result is *not* cached, repeated queries will result in repeated
|
||
|
8 years ago
|
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
|
||
|
|
* neither @extension{KHR,debug} (covered also by
|
||
|
|
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
|
||
|
|
* desktop or ES extension is available, this function returns empty
|
||
|
|
* string.
|
||
|
8 years ago
|
* @see @fn_gl_keyword{GetObjectLabel} or
|
||
|
|
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
|
||
|
13 years ago
|
* @def_gl{TEXTURE}
|
||
|
11 years ago
|
* @requires_gles Debug output is not available in WebGL.
|
||
|
13 years ago
|
*/
|
||
|
12 years ago
|
std::string label();
|
||
|
13 years ago
|
|
||
|
|
/**
|
||
|
|
* @brief Set texture label
|
||
|
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
8 years ago
|
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
|
||
|
|
* supported and neither @extension{KHR,debug} (covered also by
|
||
|
|
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
|
||
|
|
* desktop or ES extension is available, this function does nothing.
|
||
|
8 years ago
|
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
|
||
|
|
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
|
||
|
13 years ago
|
* @def_gl{TEXTURE}
|
||
|
11 years ago
|
* @requires_gles Debug output is not available in WebGL.
|
||
|
13 years ago
|
*/
|
||
|
12 years ago
|
AbstractTexture& setLabel(const std::string& label) {
|
||
|
|
return setLabelInternal({label.data(), label.size()});
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload */
|
||
|
|
template<std::size_t size> AbstractTexture& setLabel(const char(&label)[size]) {
|
||
|
11 years ago
|
return setLabelInternal({label, size - 1});
|
||
|
12 years ago
|
}
|
||
|
11 years ago
|
#endif
|
||
|
13 years ago
|
|
||
|
14 years ago
|
/**
|
||
|
12 years ago
|
* @brief Bind texture to given texture unit
|
||
|
14 years ago
|
*
|
||
|
11 years ago
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5),
|
||
|
|
* @extension{ARB,multi_bind} (part of OpenGL 4.4) nor
|
||
|
|
* @extension{EXT,direct_state_access} desktop extension is available,
|
||
|
|
* the texture unit is made active before binding the texture.
|
||
|
12 years ago
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
12 years ago
|
* @see @ref bind(Int, std::initializer_list<AbstractTexture*>),
|
||
|
|
* @ref unbind(), @ref Shader::maxCombinedTextureImageUnits(),
|
||
|
8 years ago
|
* @fn_gl_keyword{BindTextureUnit}, @fn_gl_keyword{BindTextures},
|
||
|
|
* @fn_gl_extension_keyword{BindMultiTexture,EXT,direct_state_access},
|
||
|
|
* eventually @fn_gl_keyword{ActiveTexture} and
|
||
|
|
* @fn_gl_keyword{BindTexture}
|
||
|
14 years ago
|
*/
|
||
|
12 years ago
|
void bind(Int textureUnit);
|
||
|
15 years ago
|
|
||
|
13 years ago
|
#ifdef DOXYGEN_GENERATING_OUTPUT
|
||
|
|
private:
|
||
|
|
#else
|
||
|
15 years ago
|
protected:
|
||
|
13 years ago
|
#endif
|
||
|
13 years ago
|
template<UnsignedInt textureDimensions> struct DataHelper {};
|
||
|
15 years ago
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
static Int compressedBlockDataSize(GLenum target, TextureFormat format);
|
||
|
|
#endif
|
||
|
|
|
||
|
10 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
static void bindImagesInternal(Int firstImageUnit, Containers::ArrayView<AbstractTexture* const> textures);
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
explicit AbstractTexture(GLenum target);
|
||
|
11 years ago
|
explicit AbstractTexture(NoCreateT, GLenum target) noexcept: _target{target}, _id{0}, _flags{ObjectFlag::DeleteOnDestruction} {}
|
||
|
11 years ago
|
explicit AbstractTexture(GLuint id, GLenum target, ObjectFlags flags) noexcept: _target{target}, _id{id}, _flags{flags} {}
|
||
|
12 years ago
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
11 years ago
|
AbstractTexture& setLabelInternal(Containers::ArrayView<const char> label);
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL createIfNotAlready();
|
||
|
11 years ago
|
|
||
|
10 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
void bindImageInternal(Int imageUnit, Int level, bool layered, Int layer, ImageAccess access, ImageFormat format);
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
/* Unlike bind() this also sets the texture binding unit as active */
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindInternal();
|
||
|
14 years ago
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
void setBaseLevel(Int level);
|
||
|
|
#endif
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
12 years ago
|
void setMaxLevel(Int level);
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
void setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap);
|
||
|
|
void setMagnificationFilter(Sampler::Filter filter);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
void setMinLod(Float lod);
|
||
|
|
void setMaxLod(Float lod);
|
||
|
|
#endif
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void setLodBias(Float bias);
|
||
|
|
#endif
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
12 years ago
|
void setBorderColor(const Color4& color);
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
void setBorderColor(const Vector4i& color);
|
||
|
|
void setBorderColor(const Vector4ui& color);
|
||
|
12 years ago
|
#endif
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
void setMaxAnisotropy(Float anisotropy);
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
12 years ago
|
void setSRGBDecode(bool decode);
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
12 years ago
|
template<char r, char g, char b, char a> void setSwizzle() {
|
||
|
|
setSwizzleInternal(Implementation::TextureSwizzle<r>::Value,
|
||
|
|
Implementation::TextureSwizzle<g>::Value,
|
||
|
|
Implementation::TextureSwizzle<b>::Value,
|
||
|
|
Implementation::TextureSwizzle<a>::Value);
|
||
|
|
}
|
||
|
|
void setSwizzleInternal(GLint r, GLint g, GLint b, GLint a);
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
12 years ago
|
void setCompareMode(Sampler::CompareMode mode);
|
||
|
|
void setCompareFunction(Sampler::CompareFunction function);
|
||
|
11 years ago
|
#endif
|
||
|
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
12 years ago
|
void setDepthStencilMode(Sampler::DepthStencilMode mode);
|
||
|
|
#endif
|
||
|
12 years ago
|
void invalidateImage(Int level);
|
||
|
|
void generateMipmap();
|
||
|
|
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
12 years ago
|
template<UnsignedInt dimensions> void image(GLint level, Image<dimensions>& image);
|
||
|
|
template<UnsignedInt dimensions> void image(GLint level, BufferImage<dimensions>& image, BufferUsage usage);
|
||
|
11 years ago
|
template<UnsignedInt dimensions> void compressedImage(GLint level, CompressedImage<dimensions>& image);
|
||
|
|
template<UnsignedInt dimensions> void compressedImage(GLint level, CompressedBufferImage<dimensions>& image, BufferUsage usage);
|
||
|
11 years ago
|
template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>& image);
|
||
|
|
template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>& image, BufferUsage usage);
|
||
|
11 years ago
|
template<UnsignedInt dimensions> void compressedSubImage(GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedImage<dimensions>& image);
|
||
|
|
template<UnsignedInt dimensions> void compressedSubImage(GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedBufferImage<dimensions>& image, BufferUsage usage);
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
14 years ago
|
GLenum _target;
|
||
|
14 years ago
|
|
||
|
15 years ago
|
private:
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static Int MAGNUM_GL_LOCAL compressedBlockDataSizeImplementationDefault(GLenum target, TextureFormat format);
|
||
|
|
static Int MAGNUM_GL_LOCAL compressedBlockDataSizeImplementationBitsWorkaround(GLenum target, TextureFormat format);
|
||
|
10 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL unbindImplementationDefault(GLint textureUnit);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL unbindImplementationMulti(GLint textureUnit);
|
||
|
|
static void MAGNUM_GL_LOCAL unbindImplementationDSA(GLint textureUnit);
|
||
|
|
static void MAGNUM_GL_LOCAL unbindImplementationDSAEXT(GLint textureUnit);
|
||
|
12 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL bindImplementationFallback(GLint firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL bindImplementationMulti(GLint firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures);
|
||
|
12 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL createImplementationDefault();
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL createImplementationDSA();
|
||
|
12 years ago
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
template<UnsignedInt dimensions> std::size_t MAGNUM_GL_LOCAL compressedSubImageSize(TextureFormat format, const Math::Vector<dimensions, Int>& size);
|
||
|
11 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindImplementationDefault(GLint textureUnit);
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindImplementationMulti(GLint textureUnit);
|
||
|
|
void MAGNUM_GL_LOCAL bindImplementationDSA(GLint textureUnit);
|
||
|
|
void MAGNUM_GL_LOCAL bindImplementationDSAEXT(GLint textureUnit);
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterImplementationDefault(GLenum parameter, GLint value);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDefault(GLenum parameter, GLfloat value);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterImplementationDefault(GLenum parameter, const GLint* values);
|
||
|
12 years ago
|
#endif
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterImplementationDefault(GLenum parameter, const GLfloat* values);
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterIImplementationDefault(GLenum parameter, const GLuint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationDefault(GLenum parameter, const GLint* values);
|
||
|
9 years ago
|
#ifdef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterIImplementationEXT(GLenum parameter, const GLuint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationEXT(GLenum parameter, const GLint* values);
|
||
|
9 years ago
|
#endif
|
||
|
14 years ago
|
#endif
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL parameterImplementationDSA(GLenum parameter, GLint value);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSAEXT(GLenum parameter, GLint value);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSA(GLenum parameter, GLfloat value);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSAEXT(GLenum parameter, GLfloat value);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSA(GLenum parameter, const GLint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSAEXT(GLenum parameter, const GLint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSA(GLenum parameter, const GLfloat* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterImplementationDSAEXT(GLenum parameter, const GLfloat* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationDSA(GLenum parameter, const GLuint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationDSAEXT(GLenum parameter, const GLuint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationDSA(GLenum parameter, const GLint* values);
|
||
|
|
void MAGNUM_GL_LOCAL parameterIImplementationDSAEXT(GLenum parameter, const GLint* values);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void MAGNUM_GL_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat);
|
||
|
8 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL setMaxAnisotropyImplementationArb(GLfloat anisotropy);
|
||
|
8 years ago
|
#endif
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy);
|
||
|
13 years ago
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values);
|
||
|
|
void MAGNUM_GL_LOCAL getLevelParameterImplementationDSAEXT(GLint level, GLenum parameter, GLint* values);
|
||
|
13 years ago
|
#endif
|
||
|
12 years ago
|
#endif
|
||
|
13 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL mipmapImplementationDefault();
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL mipmapImplementationDSA();
|
||
|
|
void MAGNUM_GL_LOCAL mipmapImplementationDSAEXT();
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
|
||
|
|
void MAGNUM_GL_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
|
||
|
|
void MAGNUM_GL_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
|
||
|
|
void MAGNUM_GL_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2)
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
|
||
|
11 years ago
|
#endif
|
||
|
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
|
||
|
|
void MAGNUM_GL_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationFallback(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
|
||
|
11 years ago
|
#endif
|
||
|
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationDefault(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageImplementationDSA(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
|
||
|
|
void MAGNUM_GL_LOCAL storageImplementationDSAEXT(GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationFallback(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
|
||
|
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationFallback(GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
|
||
|
12 years ago
|
#endif
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDefault(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
|
||
|
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDefault(GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
|
||
|
9 years ago
|
#ifdef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationOES(GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
|
||
|
9 years ago
|
#endif
|
||
|
12 years ago
|
#endif
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDSA(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
|
||
|
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDSA(GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
|
||
|
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDSAEXT(GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
|
||
|
|
void MAGNUM_GL_LOCAL storageMultisampleImplementationDSAEXT(GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
|
||
|
12 years ago
|
#endif
|
||
|
|
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL getImageImplementationDefault(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getImageImplementationDSA(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getImageImplementationDSAEXT(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getImageImplementationRobustness(GLint level, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
11 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL getCompressedImageImplementationDefault(GLint level, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getCompressedImageImplementationDSA(GLint level, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getCompressedImageImplementationDSAEXT(GLint level, std::size_t dataSize, GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL getCompressedImageImplementationRobustness(GLint level, std::size_t dataSize, GLvoid* data);
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL subImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data);
|
||
|
|
void MAGNUM_GL_LOCAL subImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, PixelFormat format, PixelType type, const GLvoid* data);
|
||
|
11 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDefault(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSA(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL imageImplementationDefault(GLenum target, GLint level, TextureFormat internalFormat, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL imageImplementationSvga3DSliceBySlice(GLenum target, GLint level, TextureFormat internalFormat, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#endif
|
||
|
|
/* Had to put explicit "2D" in the name so it's not overloaded and
|
||
|
|
Clang is able to pass it as template parameter to
|
||
|
|
subImageImplementationSvga3DSliceBySlice(). GCC had no problem with
|
||
|
|
the original. */
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImage2DImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
template<void(AbstractTexture::*original)(GLint, const Vector2i&, const Vector2i&, PixelFormat, PixelType, const GLvoid*, const PixelStorage&)> void MAGNUM_GL_LOCAL subImageImplementationSvga3DSliceBySlice(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage& storage);
|
||
|
9 years ago
|
#endif
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImage2DImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
|
void MAGNUM_GL_LOCAL subImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL imageImplementationDefault(GLint level, TextureFormat internalFormat, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL imageImplementationSvga3DSliceBySlice(GLint level, TextureFormat internalFormat, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#endif
|
||
|
|
/* Had to put explicit "3D" in the name so it's not overloaded and
|
||
|
|
Clang is able to pass it as template parameter to
|
||
|
|
subImageImplementationSvga3DSliceBySlice(). GCC had no problem with
|
||
|
|
the original. */
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImage3DImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
8 years ago
|
template<void(AbstractTexture::*original)(GLint, const Vector3i&, const Vector3i&, PixelFormat, PixelType, const GLvoid*, const PixelStorage&)> void MAGNUM_GL_LOCAL subImageImplementationSvga3DSliceBySlice(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage& storage);
|
||
|
9 years ago
|
#endif
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDefault(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImage3DImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL subImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, PixelFormat format, PixelType type, const GLvoid* data, const PixelStorage&);
|
||
|
9 years ago
|
#endif
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSA(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
|
void MAGNUM_GL_LOCAL compressedSubImageImplementationDSAEXT(GLint level, const Vector3i& offset, const Vector3i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImageImplementationNoOp(GLint level);
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImageImplementationARB(GLint level);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateSubImageImplementationNoOp(GLint level, const Vector3i& offset, const Vector3i& size);
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateSubImageImplementationARB(GLint level, const Vector3i& offset, const Vector3i& size);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
14 years ago
|
GLuint _id;
|
||
|
11 years ago
|
ObjectFlags _flags;
|
||
|
15 years ago
|
};
|
||
|
|
|
||
|
15 years ago
|
#ifndef DOXYGEN_GENERATING_OUTPUT
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
template<> struct MAGNUM_GL_EXPORT AbstractTexture::DataHelper<1> {
|
||
|
11 years ago
|
static Math::Vector<1, GLint> compressedBlockSize(GLenum target, TextureFormat format);
|
||
|
10 years ago
|
static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLint level);
|
||
|
13 years ago
|
|
||
|
12 years ago
|
static void setWrapping(AbstractTexture& texture, const Array1D<Sampler::Wrapping>& wrapping);
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size);
|
||
|
14 years ago
|
|
||
|
11 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, const ImageView1D& image);
|
||
|
12 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, BufferImage1D& image);
|
||
|
11 years ago
|
static void setCompressedImage(AbstractTexture& texture, GLint level, const CompressedImageView1D& image);
|
||
|
|
static void setCompressedImage(AbstractTexture& texture, GLint level, CompressedBufferImage1D& image);
|
||
|
14 years ago
|
|
||
|
11 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, const ImageView1D& image);
|
||
|
12 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image);
|
||
|
11 years ago
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, const CompressedImageView1D& image);
|
||
|
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, CompressedBufferImage1D& image);
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void invalidateSubImage(AbstractTexture& texture, GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size);
|
||
|
15 years ago
|
};
|
||
|
14 years ago
|
#endif
|
||
|
8 years ago
|
template<> struct MAGNUM_GL_EXPORT AbstractTexture::DataHelper<2> {
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
static Vector2i compressedBlockSize(GLenum target, TextureFormat format);
|
||
|
|
#endif
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
10 years ago
|
static Vector2i imageSize(AbstractTexture& texture, GLint level);
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
12 years ago
|
static void setWrapping(AbstractTexture& texture, const Array2D<Sampler::Wrapping>& wrapping);
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
|
||
|
14 years ago
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
12 years ago
|
static void setStorageMultisample(AbstractTexture& texture, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedSampleLocations);
|
||
|
12 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
11 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, const ImageView2D& image) {
|
||
|
12 years ago
|
setImage(texture, texture._target, level, internalFormat, image);
|
||
|
|
}
|
||
|
11 years ago
|
static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageView2D& image);
|
||
|
11 years ago
|
static void setCompressedImage(AbstractTexture& texture, GLint level, const CompressedImageView2D& image) {
|
||
|
|
setCompressedImage(texture, texture._target, level, image);
|
||
|
|
}
|
||
|
|
static void setCompressedImage(AbstractTexture& texture, GLenum target, GLint level, const CompressedImageView2D& image);
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, BufferImage2D& image) {
|
||
|
|
setImage(texture, texture._target, level, internalFormat, image);
|
||
|
|
}
|
||
|
12 years ago
|
static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, BufferImage2D& image);
|
||
|
11 years ago
|
static void setCompressedImage(AbstractTexture& texture, GLint level, CompressedBufferImage2D& image) {
|
||
|
|
setCompressedImage(texture, texture._target, level, image);
|
||
|
|
}
|
||
|
|
static void setCompressedImage(AbstractTexture& texture, GLenum target, GLint level, CompressedBufferImage2D& image);
|
||
|
13 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
11 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const ImageView2D& image);
|
||
|
11 years ago
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const CompressedImageView2D& image);
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, BufferImage2D& image);
|
||
|
11 years ago
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, CompressedBufferImage2D& image);
|
||
|
13 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector2i& offset, const Vector2i& size);
|
||
|
15 years ago
|
};
|
||
|
8 years ago
|
template<> struct MAGNUM_GL_EXPORT AbstractTexture::DataHelper<3> {
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
static Vector3i compressedBlockSize(GLenum target, TextureFormat format);
|
||
|
|
#endif
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
10 years ago
|
static Vector3i imageSize(AbstractTexture& texture, GLint level);
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
12 years ago
|
static void setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping);
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void setStorage(AbstractTexture& texture, GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
|
||
|
14 years ago
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
12 years ago
|
static void setStorageMultisample(AbstractTexture& texture, GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedSampleLocations);
|
||
|
12 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
11 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, const ImageView3D& image);
|
||
|
11 years ago
|
static void setCompressedImage(AbstractTexture& texture, GLint level, const CompressedImageView3D& image);
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
static void setImage(AbstractTexture& texture, GLint level, TextureFormat internalFormat, BufferImage3D& image);
|
||
|
11 years ago
|
static void setCompressedImage(AbstractTexture& texture, GLint level, CompressedBufferImage3D& image);
|
||
|
13 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
11 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const ImageView3D& image);
|
||
|
11 years ago
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const CompressedImageView3D& image);
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
static void setSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, BufferImage3D& image);
|
||
|
11 years ago
|
static void setCompressedSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, CompressedBufferImage3D& image);
|
||
|
13 years ago
|
#endif
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
12 years ago
|
static void invalidateSubImage(AbstractTexture& texture, GLint level, const Vector3i& offset, const Vector3i& size);
|
||
|
15 years ago
|
};
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
inline AbstractTexture::AbstractTexture(AbstractTexture&& other) noexcept: _target{other._target}, _id{other._id}, _flags{other._flags} {
|
||
|
13 years ago
|
other._id = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
inline AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) noexcept {
|
||
|
11 years ago
|
using std::swap;
|
||
|
|
swap(_target, other._target);
|
||
|
|
swap(_id, other._id);
|
||
|
11 years ago
|
swap(_flags, other._flags);
|
||
|
13 years ago
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
inline GLuint AbstractTexture::release() {
|
||
|
|
const GLuint id = _id;
|
||
|
|
_id = 0;
|
||
|
|
return id;
|
||
|
|
}
|
||
|
|
|
||
|
15 years ago
|
}
|
||
|
|
|
||
|
|
#endif
|