Browse Source

Links to documentation of related gl*() function.

Each function touching OpenGL now has list of all related functions
touching OpenGL.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
035bd4d376
  1. 2
      Doxyfile
  2. 32
      src/AbstractShaderProgram.h
  3. 15
      src/AbstractTexture.h
  4. 26
      src/Buffer.h
  5. 7
      src/BufferedImage.h
  6. 19
      src/BufferedTexture.h
  7. 2
      src/CubeMapTexture.h
  8. 2
      src/CubeMapTextureArray.h
  9. 76
      src/Framebuffer.h
  10. 14
      src/IndexedMesh.h
  11. 41
      src/Mesh.h
  12. 16
      src/Query.h
  13. 10
      src/Renderbuffer.h
  14. 7
      src/Shader.h
  15. 4
      src/Texture.h

2
Doxyfile

@ -200,6 +200,8 @@ ALIASES = \
"configurationvalue{1}=@brief %Configuration value parser and writer @xrefitem configurationvalues \"Configuration value parser and writer\" \"Configuration value parsers and writers for custom types\" Allows parsing and writing \1 from and to Corrade::Utility::Configuration." \ "configurationvalue{1}=@brief %Configuration value parser and writer @xrefitem configurationvalues \"Configuration value parser and writer\" \"Configuration value parsers and writers for custom types\" Allows parsing and writing \1 from and to Corrade::Utility::Configuration." \
"collisionoperator{2}=@relates \1\n@brief Collision of %\1 and %\2\n@see \2::operator%(const \1&) const" \ "collisionoperator{2}=@relates \1\n@brief Collision of %\1 and %\2\n@see \2::operator%(const \1&) const" \
"todoc=@xrefitem todoc \"Documentation todo\" \"Documentation-related todo list\"" \ "todoc=@xrefitem todoc \"Documentation todo\" \"Documentation-related todo list\"" \
"fn_gl{1}=<a href=\"http://www.opengl.org/sdk/docs/man4/xhtml/gl\1.xml\">gl\1()</a>" \
"def_gl{1}=`GL_\1`" \
"requires_gl=@xrefitem requires-gl \"Requires desktop OpenGL\" \"Functionality requiring desktop OpenGL (not available on OpenGL ES)\" Not available on OpenGL ES." \ "requires_gl=@xrefitem requires-gl \"Requires desktop OpenGL\" \"Functionality requiring desktop OpenGL (not available on OpenGL ES)\" Not available on OpenGL ES." \
"requires_gl30=@xrefitem requires-gl30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \ "requires_gl30=@xrefitem requires-gl30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \
"requires_gl31=@xrefitem requires-gl31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \ "requires_gl31=@xrefitem requires-gl31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \

32
src/AbstractShaderProgram.h

@ -192,6 +192,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @brief Constructor * @brief Constructor
* *
* Creates one OpenGL shader program. * Creates one OpenGL shader program.
* @see @fn_gl{CreateProgram}
*/ */
inline AbstractShaderProgram(): state(Initialized) { inline AbstractShaderProgram(): state(Initialized) {
program = glCreateProgram(); program = glCreateProgram();
@ -201,6 +202,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @brief Destructor * @brief Destructor
* *
* Deletes associated OpenGL shader program. * Deletes associated OpenGL shader program.
* @see @fn_gl{DeleteProgram}
*/ */
virtual ~AbstractShaderProgram() = 0; virtual ~AbstractShaderProgram() = 0;
@ -208,6 +210,8 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @brief Use shader * @brief Use shader
* @return False if the program wasn't successfully linked, true * @return False if the program wasn't successfully linked, true
* otherwise. * otherwise.
*
* @see @fn_gl{UseProgram}
*/ */
bool use(); bool use();
@ -216,11 +220,12 @@ class MAGNUM_EXPORT AbstractShaderProgram {
/** /**
* @brief Allow retrieving program binary * @brief Allow retrieving program binary
* *
* Disabled by default. * Initially disabled.
* @requires_gl
* @requires_gl41 Extension @extension{ARB,get_program_binary}
* @note This function should be called after attachShader() calls and * @note This function should be called after attachShader() calls and
* before link(). * before link().
* @see @fn_gl{ProgramParameter} with @def_gl{PROGRAM_BINARY_RETRIEVABLE_HINT}
* @requires_gl
* @requires_gl41 Extension @extension{ARB,get_program_binary}
*/ */
inline void setRetrievableBinary(bool enabled) { inline void setRetrievableBinary(bool enabled) {
glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, enabled ? GL_TRUE : GL_FALSE); glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, enabled ? GL_TRUE : GL_FALSE);
@ -229,11 +234,12 @@ class MAGNUM_EXPORT AbstractShaderProgram {
/** /**
* @brief Allow the program to be bound to individual pipeline stages * @brief Allow the program to be bound to individual pipeline stages
* *
* Disabled by default. * Initially disabled.
* @requires_gl
* @requires_gl41 Extension @extension{ARB,separate_shader_objects}
* @note This function should be called after attachShader() calls and * @note This function should be called after attachShader() calls and
* before link(). * before link().
* @see @fn_gl{ProgramParameter} with @def_gl{PROGRAM_SEPARABLE}
* @requires_gl
* @requires_gl41 Extension @extension{ARB,separate_shader_objects}
*/ */
inline void setSeparable(bool enabled) { inline void setSeparable(bool enabled) {
glProgramParameteri(program, GL_PROGRAM_SEPARABLE, enabled ? GL_TRUE : GL_FALSE); glProgramParameteri(program, GL_PROGRAM_SEPARABLE, enabled ? GL_TRUE : GL_FALSE);
@ -247,10 +253,11 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* *
* Compiles the shader, if it is not already, and prepares it for * Compiles the shader, if it is not already, and prepares it for
* linking. * linking.
* @see Shader::compile(), @fn_gl{AttachShader}
*/ */
bool attachShader(Shader& shader); bool attachShader(Shader& shader);
/** @copydoc attachShader(Shader&) */ /** @overload */
inline bool attachShader(Shader&& shader) { inline bool attachShader(Shader&& shader) {
return attachShader(shader); return attachShader(shader);
} }
@ -268,6 +275,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* explicitly in the shader instead of using this function. See * explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-attribute-location "class documentation" * @ref AbstractShaderProgram-attribute-location "class documentation"
* for more information. * for more information.
* @see @fn_gl{BindAttribLocation}
*/ */
void bindAttributeLocation(GLuint location, const std::string& name); void bindAttributeLocation(GLuint location, const std::string& name);
@ -281,14 +289,15 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* Binds fragment data to location which is used later for framebuffer * Binds fragment data to location which is used later for framebuffer
* operations. See also Framebuffer::BlendFunction for more * operations. See also Framebuffer::BlendFunction for more
* information about using color input index. * information about using color input index.
* @requires_gl
* @requires_gl33 Extension @extension{ARB,blend_func_extended}
* @note This function should be called after attachShader() calls and * @note This function should be called after attachShader() calls and
* before link(). * before link().
* @deprecated Preferred usage is to specify attribute location * @deprecated Preferred usage is to specify attribute location
* explicitly in the shader instead of using this function. See * explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-attribute-location "class documentation" * @ref AbstractShaderProgram-attribute-location "class documentation"
* for more information. * for more information.
* @see @fn_gl{BindFragDataLocationIndexed}
* @requires_gl
* @requires_gl33 Extension @extension{ARB,blend_func_extended}
*/ */
void bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name); void bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name);
@ -299,6 +308,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* *
* The same as bindFragmentDataLocationIndexed(), but with `index` set * The same as bindFragmentDataLocationIndexed(), but with `index` set
* to `0`. * to `0`.
* @see @fn_gl{BindFragDataLocation}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,gpu_shader4} * @requires_gl30 Extension @extension{EXT,gpu_shader4}
*/ */
@ -310,6 +320,8 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* *
* Binds previously specified attributes to given indexes and links the * Binds previously specified attributes to given indexes and links the
* shader program together. * shader program together.
* @see @fn_gl{LinkProgram}, @fn_gl{GetProgram} with
* @def_gl{LINK_STATUS}, @fn_gl{GetProgramInfoLog}
*/ */
void link(); void link();
@ -318,6 +330,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @param name Uniform name * @param name Uniform name
* *
* @note This function should be called after link(). * @note This function should be called after link().
* @see @fn_gl{GetUniformLocation}
*/ */
GLint uniformLocation(const std::string& name); GLint uniformLocation(const std::string& name);
@ -327,6 +340,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @param value Value * @param value Value
* *
* @attention This function doesn't check whether this shader is in use! * @attention This function doesn't check whether this shader is in use!
* @see @fn_gl{Uniform}
*/ */
inline void setUniform(GLint location, GLfloat value) { inline void setUniform(GLint location, GLfloat value) {
glUniform1f(location, value); glUniform1f(location, value);

15
src/AbstractTexture.h

@ -535,7 +535,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @brief Max supported layer count * @brief Max supported layer count
* *
* At least 48. * At least 48.
* @see bind(GLint) * @see bind(GLint), @fn_gl{Get} with @def_gl{MAX_COMBINED_TEXTURE_IMAGE_UNITS}
*/ */
static GLint maxSupportedLayerCount(); static GLint maxSupportedLayerCount();
@ -543,7 +543,7 @@ class MAGNUM_EXPORT AbstractTexture {
/** /**
* @brief Max supported anisotropy * @brief Max supported anisotropy
* *
* @see setMaxAnisotropy() * @see setMaxAnisotropy(), @fn_gl{Get} with @def_gl{MAX_TEXTURE_MAX_ANISOTROPY_EXT}
* @requires_extension @extension{EXT,texture_filter_anisotropic} * @requires_extension @extension{EXT,texture_filter_anisotropic}
*/ */
static GLfloat maxSupportedAnisotropy(); static GLfloat maxSupportedAnisotropy();
@ -554,6 +554,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @param target Target, e.g. `GL_TEXTURE_2D`. * @param target Target, e.g. `GL_TEXTURE_2D`.
* *
* Creates one OpenGL texture. * Creates one OpenGL texture.
* @see @fn_gl{GenTextures}
*/ */
inline AbstractTexture(GLenum target): _target(target) { inline AbstractTexture(GLenum target): _target(target) {
glGenTextures(1, &texture); glGenTextures(1, &texture);
@ -563,6 +564,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @brief Destructor * @brief Destructor
* *
* Deletes assigned OpenGL texture. * Deletes assigned OpenGL texture.
* @see @fn_gl{DeleteTextures}
*/ */
virtual ~AbstractTexture() = 0; virtual ~AbstractTexture() = 0;
@ -575,6 +577,7 @@ class MAGNUM_EXPORT AbstractTexture {
* Sets current texture as active in given layer. The layer must be * Sets current texture as active in given layer. The layer must be
* between 0 and maxSupportedLayerCount(). Note that only one texture * between 0 and maxSupportedLayerCount(). Note that only one texture
* can be bound to given layer. * can be bound to given layer.
* @see bind(), @fn_gl{ActiveTexture}
*/ */
inline void bind(GLint layer) { inline void bind(GLint layer) {
glActiveTexture(GL_TEXTURE0 + layer); glActiveTexture(GL_TEXTURE0 + layer);
@ -595,6 +598,7 @@ class MAGNUM_EXPORT AbstractTexture {
* see @ref AbstractTexture::Filter "Filter" and * see @ref AbstractTexture::Filter "Filter" and
* @ref AbstractTexture::Mipmap "Mipmap" documentation for more * @ref AbstractTexture::Mipmap "Mipmap" documentation for more
* information. * information.
* @see bind(), @fn_gl{TexParameter} with @def_gl{TEXTURE_MIN_FILTER}
*/ */
AbstractTexture* setMinificationFilter(Filter filter, Mipmap mipmap = Mipmap::BaseLevel); AbstractTexture* setMinificationFilter(Filter filter, Mipmap mipmap = Mipmap::BaseLevel);
@ -605,6 +609,7 @@ class MAGNUM_EXPORT AbstractTexture {
* *
* 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. * texture size.
* @see bind(), @fn_gl{TexParameter} with @def_gl{TEXTURE_MAG_FILTER}
*/ */
inline AbstractTexture* setMagnificationFilter(Filter filter) { inline AbstractTexture* setMagnificationFilter(Filter filter) {
bind(); bind();
@ -619,6 +624,7 @@ class MAGNUM_EXPORT AbstractTexture {
* *
* Border color when @ref AbstractTexture::Wrapping "wrapping" is set * Border color when @ref AbstractTexture::Wrapping "wrapping" is set
* to `ClampToBorder`. * to `ClampToBorder`.
* @see bind(), @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_gl * @requires_gl
*/ */
inline AbstractTexture* setBorderColor(const Color4<GLfloat>& color) { inline AbstractTexture* setBorderColor(const Color4<GLfloat>& color) {
@ -633,7 +639,7 @@ class MAGNUM_EXPORT AbstractTexture {
* *
* Default value is `1.0`, which means no anisotropy. Set to value * Default value is `1.0`, which means no anisotropy. Set to value
* greater than `1.0` for anisotropic filtering. * greater than `1.0` for anisotropic filtering.
* @see maxSupportedAnisotropy() * @see maxSupportedAnisotropy(), bind(), @fn_gl{TexParameter} with @def_gl{TEXTURE_MAX_ANISOTROPY_EXT}
* @requires_extension @extension{EXT,texture_filter_anisotropic} * @requires_extension @extension{EXT,texture_filter_anisotropic}
*/ */
inline AbstractTexture* setMaxAnisotropy(GLfloat anisotropy) { inline AbstractTexture* setMaxAnisotropy(GLfloat anisotropy) {
@ -648,7 +654,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
* *
* Can not be used for rectangle textures. * Can not be used for rectangle textures.
* @see setMinificationFilter() * @see setMinificationFilter(), @fn_gl{GenerateMipmap}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
AbstractTexture* generateMipmap(); AbstractTexture* generateMipmap();
@ -665,6 +671,7 @@ class MAGNUM_EXPORT AbstractTexture {
* *
* Unlike bind(GLint) doesn't bind the texture to any particular * Unlike bind(GLint) doesn't bind the texture to any particular
* layer, thus unusable for binding for rendering. * layer, thus unusable for binding for rendering.
* @see @fn_gl{BindTexture}
*/ */
inline void bind() { inline void bind() {
glBindTexture(_target, texture); glBindTexture(_target, texture);

26
src/Buffer.h

@ -109,7 +109,7 @@ class Buffer {
#endif #endif
}; };
/** @brief Buffer usage */ /** @brief %Buffer usage */
enum class Usage: GLenum { enum class Usage: GLenum {
/** /**
* Set once by the application and used infrequently for drawing. * Set once by the application and used infrequently for drawing.
@ -181,6 +181,8 @@ class Buffer {
/** /**
* @brief Unbind any buffer from given target * @brief Unbind any buffer from given target
* @param target %Target * @param target %Target
*
* @see @fn_gl{BindBuffer}
*/ */
inline static void unbind(Target target) { inline static void unbind(Target target) {
glBindBuffer(static_cast<GLenum>(target), 0); glBindBuffer(static_cast<GLenum>(target), 0);
@ -192,6 +194,7 @@ class Buffer {
* without parameter) * without parameter)
* *
* Generates new OpenGL buffer. * Generates new OpenGL buffer.
* @see @fn_gl{GenBuffers}
*/ */
inline Buffer(Target defaultTarget): _defaultTarget(defaultTarget) { inline Buffer(Target defaultTarget): _defaultTarget(defaultTarget) {
glGenBuffers(1, &buffer); glGenBuffers(1, &buffer);
@ -201,6 +204,7 @@ class Buffer {
* @brief Destructor * @brief Destructor
* *
* Deletes associated OpenGL buffer. * Deletes associated OpenGL buffer.
* @see @fn_gl{DeleteBuffers}
*/ */
inline virtual ~Buffer() { inline virtual ~Buffer() {
glDeleteBuffers(1, &buffer); glDeleteBuffers(1, &buffer);
@ -216,12 +220,15 @@ class Buffer {
* @brief Bind buffer * @brief Bind buffer
* *
* Binds buffer with default target. * Binds buffer with default target.
* @see bind(Target)
*/ */
inline void bind() { bind(_defaultTarget); } inline void bind() { bind(_defaultTarget); }
/** /**
* @brief Bind buffer * @brief Bind buffer
* @param target %Target * @param target %Target
*
* @see @fn_gl{BindBuffer}
*/ */
inline void bind(Target target) { inline void bind(Target target) {
glBindBuffer(static_cast<GLenum>(target), buffer); glBindBuffer(static_cast<GLenum>(target), buffer);
@ -234,6 +241,7 @@ class Buffer {
* @param usage %Buffer usage * @param usage %Buffer usage
* *
* Sets buffer data with default target. * Sets buffer data with default target.
* @see setData(Target, GLsizeiptr, const GLvoid*, Usage)
*/ */
inline void setData(GLsizeiptr size, const GLvoid* data, Usage usage) { inline void setData(GLsizeiptr size, const GLvoid* data, Usage usage) {
setData(_defaultTarget, size, data, usage); setData(_defaultTarget, size, data, usage);
@ -247,6 +255,7 @@ class Buffer {
* Sets buffer data with default target. More convenient for setting * Sets buffer data with default target. More convenient for setting
* data from fixed-size arrays than * data from fixed-size arrays than
* setData(GLsizeiptr, const GLvoid*, Usage). * setData(GLsizeiptr, const GLvoid*, Usage).
* @see setData(Target, GLsizeiptr, const GLvoid*, Usage)
*/ */
template<size_t size, class T> inline void setData(const T(&data)[size], Usage usage) { template<size_t size, class T> inline void setData(const T(&data)[size], Usage usage) {
setData(_defaultTarget, data, usage); setData(_defaultTarget, data, usage);
@ -258,6 +267,7 @@ class Buffer {
* @param usage %Buffer usage * @param usage %Buffer usage
* *
* Sets buffer data with default target. * Sets buffer data with default target.
* @see setData(Target, GLsizeiptr, const GLvoid*, Usage)
*/ */
template<class T> inline void setData(const std::vector<T>& data, Usage usage) { template<class T> inline void setData(const std::vector<T>& data, Usage usage) {
setData(_defaultTarget, data, usage); setData(_defaultTarget, data, usage);
@ -269,6 +279,8 @@ class Buffer {
* @param size Data size * @param size Data size
* @param data Pointer to data * @param data Pointer to data
* @param usage %Buffer usage * @param usage %Buffer usage
*
* @see bind(Target), @fn_gl{BufferData}
*/ */
inline void setData(Target target, GLsizeiptr size, const GLvoid* data, Usage usage) { inline void setData(Target target, GLsizeiptr size, const GLvoid* data, Usage usage) {
bind(target); bind(target);
@ -283,6 +295,8 @@ class Buffer {
* *
* More convenient for setting data from fixed-size arrays than * More convenient for setting data from fixed-size arrays than
* setData(Target, GLsizeiptr, const GLvoid*, Usage). * setData(Target, GLsizeiptr, const GLvoid*, Usage).
*
* @see setData(Target, GLsizeiptr, const GLvoid*, Usage)
*/ */
template<size_t size, class T> inline void setData(Target target, const T(&data)[size], Usage usage) { template<size_t size, class T> inline void setData(Target target, const T(&data)[size], Usage usage) {
setData(target, size*sizeof(T), data, usage); setData(target, size*sizeof(T), data, usage);
@ -293,6 +307,8 @@ class Buffer {
* @param target %Target * @param target %Target
* @param data Vector with data * @param data Vector with data
* @param usage %Buffer usage * @param usage %Buffer usage
*
* @see setData(Target, GLsizeiptr, const GLvoid*, Usage)
*/ */
template<class T> inline void setData(Target target, const std::vector<T>& data, Usage usage) { template<class T> inline void setData(Target target, const std::vector<T>& data, Usage usage) {
setData(target, data.size()*sizeof(T), data.data(), usage); setData(target, data.size()*sizeof(T), data.data(), usage);
@ -305,6 +321,7 @@ class Buffer {
* @param data Pointer to data * @param data Pointer to data
* *
* Sets buffer subdata with default target. * Sets buffer subdata with default target.
* @see setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*)
*/ */
inline void setSubData(GLintptr offset, GLsizeiptr size, const GLvoid* data) { inline void setSubData(GLintptr offset, GLsizeiptr size, const GLvoid* data) {
setSubData(_defaultTarget, offset, size, data); setSubData(_defaultTarget, offset, size, data);
@ -318,6 +335,7 @@ class Buffer {
* Sets buffer subdata with default target. More convenient for * Sets buffer subdata with default target. More convenient for
* setting data from fixed-size arrays than * setting data from fixed-size arrays than
* setSubData(GLintptr, GLsizeiptr, const GLvoid*). * setSubData(GLintptr, GLsizeiptr, const GLvoid*).
* @see setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*)
*/ */
template<size_t size, class T> inline void setSubData(GLintptr offset, const T(&data)[size]) { template<size_t size, class T> inline void setSubData(GLintptr offset, const T(&data)[size]) {
setSubData(_defaultTarget, offset, data); setSubData(_defaultTarget, offset, data);
@ -329,6 +347,7 @@ class Buffer {
* @param data Vector with data * @param data Vector with data
* *
* Sets buffer subdata with default target. * Sets buffer subdata with default target.
* @see setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*)
*/ */
template<class T> inline void setSubData(GLintptr offset, const std::vector<T>& data) { template<class T> inline void setSubData(GLintptr offset, const std::vector<T>& data) {
setSubData(_defaultTarget, offset, data); setSubData(_defaultTarget, offset, data);
@ -340,6 +359,8 @@ class Buffer {
* @param offset Offset * @param offset Offset
* @param size Data size * @param size Data size
* @param data Pointer to data * @param data Pointer to data
*
* @see bind(Target), @fn_gl{BufferSubData}
*/ */
inline void setSubData(Target target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { inline void setSubData(Target target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
bind(target); bind(target);
@ -354,6 +375,7 @@ class Buffer {
* *
* More convenient for setting data from fixed-size arrays than * More convenient for setting data from fixed-size arrays than
* setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*). * setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*).
* @see setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*)
*/ */
template<size_t size, class T> inline void setSubData(Target target, GLintptr offset, const T(&data)[size]) { template<size_t size, class T> inline void setSubData(Target target, GLintptr offset, const T(&data)[size]) {
setSubData(target, offset, size*sizeof(T), data); setSubData(target, offset, size*sizeof(T), data);
@ -364,6 +386,8 @@ class Buffer {
* @param target %Target * @param target %Target
* @param offset Offset * @param offset Offset
* @param data Vector with data * @param data Vector with data
*
* @see setSubData(Target, GLintptr, GLsizeiptr, const GLvoid*)
*/ */
template<class T> inline void setSubData(Target target, GLintptr offset, const std::vector<T>& data) { template<class T> inline void setSubData(Target target, GLintptr offset, const std::vector<T>& data) {
setSubData(target, offset, data.size()*sizeof(T), data.data()); setSubData(target, offset, data.size()*sizeof(T), data.data());

7
src/BufferedImage.h

@ -32,6 +32,7 @@ namespace Magnum {
Class for storing image data in GPU memory. Can be replaced with Image, which Class for storing image data in GPU memory. Can be replaced with Image, which
stores image data in client memory, ImageWrapper, or for example with stores image data in client memory, ImageWrapper, or for example with
Trade::ImageData. Trade::ImageData.
@see Buffer
@requires_gl @requires_gl
*/ */
template<size_t imageDimensions> class BufferedImage: public AbstractImage { template<size_t imageDimensions> class BufferedImage: public AbstractImage {
@ -57,6 +58,8 @@ template<size_t imageDimensions> class BufferedImage: public AbstractImage {
* Binds the buffer to @ref Buffer::Target "pixel unpack * Binds the buffer to @ref Buffer::Target "pixel unpack
* target" and returns nullptr, so it can be used for texture updating * target" and returns nullptr, so it can be used for texture updating
* functions the same way as Image::data(). * functions the same way as Image::data().
*
* @see Buffer::bind(Target)
*/ */
void* data() { void* data() {
_buffer.bind(Buffer::Target::PixelUnpack); _buffer.bind(Buffer::Target::PixelUnpack);
@ -76,6 +79,8 @@ template<size_t imageDimensions> class BufferedImage: public AbstractImage {
* *
* Updates the image buffer with given data. The data are not deleted * Updates the image buffer with given data. The data are not deleted
* after filling the buffer. * after filling the buffer.
*
* @see setData(const Math::Vector<Dimensions, GLsizei>&, Components, ComponentType, const GLvoid*, Buffer::Usage)
*/ */
template<class T> inline void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, const T* data, Buffer::Usage usage) { template<class T> inline void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, const T* data, Buffer::Usage usage) {
setData(dimensions, components, TypeTraits<T>::imageType(), data, usage); setData(dimensions, components, TypeTraits<T>::imageType(), data, usage);
@ -91,6 +96,8 @@ template<size_t imageDimensions> class BufferedImage: public AbstractImage {
* *
* Updates the image buffer with given data. The data are not deleted * Updates the image buffer with given data. The data are not deleted
* after filling the buffer. * after filling the buffer.
*
* @see Buffer::setData()
*/ */
void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, ComponentType type, const GLvoid* data, Buffer::Usage usage) { void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, ComponentType type, const GLvoid* data, Buffer::Usage usage) {
_components = components; _components = components;

19
src/BufferedTexture.h

@ -121,17 +121,30 @@ class BufferedTexture {
* @brief Constructor * @brief Constructor
* *
* Creates one OpenGL texture. * Creates one OpenGL texture.
* @see @fn_gl{GenTextures}
*/ */
inline BufferedTexture() { inline BufferedTexture() {
glGenTextures(1, &texture); glGenTextures(1, &texture);
} }
/** @copydoc AbstractTexture::~AbstractTexture() */ /**
* @brief Destructor
*
* Deletes assigned OpenGL texture.
* @see @fn_gl{DeleteTextures}
*/
inline virtual ~BufferedTexture() { inline virtual ~BufferedTexture() {
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
} }
/** @copydoc AbstractTexture::bind(GLint) */ /**
* @brief Bind texture for rendering
*
* Sets current texture as active in given layer. The layer must be
* between 0 and maxSupportedLayerCount(). Note that only one texture
* can be bound to given layer.
* @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture}
*/
inline void bind(GLint layer) { inline void bind(GLint layer) {
glActiveTexture(GL_TEXTURE0 + layer); glActiveTexture(GL_TEXTURE0 + layer);
bind(); bind();
@ -145,6 +158,7 @@ class BufferedTexture {
* Binds given buffer to this texture. The buffer itself can be then * Binds given buffer to this texture. The buffer itself can be then
* filled with data of proper format at any time using Buffer own data * filled with data of proper format at any time using Buffer own data
* setting functions. * setting functions.
* @see @fn_gl{BindTexture}, @fn_gl{TexBuffer}
*/ */
void setBuffer(InternalFormat internalFormat, Buffer* buffer) { void setBuffer(InternalFormat internalFormat, Buffer* buffer) {
bind(); bind();
@ -154,7 +168,6 @@ class BufferedTexture {
private: private:
GLuint texture; GLuint texture;
/** @copydoc AbstractTexture::bind() */
inline void bind() { inline void bind() {
glBindTexture(GL_TEXTURE_BUFFER, texture); glBindTexture(GL_TEXTURE_BUFFER, texture);
} }

2
src/CubeMapTexture.h

@ -63,6 +63,7 @@ class CubeMapTexture: public AbstractTexture {
/** /**
* @brief Enable/disable seamless cube map textures * @brief Enable/disable seamless cube map textures
* *
* @see @fn_gl{Enable}/@fn_gl{Disable} with @def_gl{TEXTURE_CUBE_MAP_SEAMLESS}
* @requires_gl * @requires_gl
* @requires_gl32 Extension @extension{ARB,seamless_cube_map} * @requires_gl32 Extension @extension{ARB,seamless_cube_map}
*/ */
@ -75,6 +76,7 @@ class CubeMapTexture: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates one cube map OpenGL texture. * Creates one cube map OpenGL texture.
* @see @def_gl{TEXTURE_CUBE_MAP}
*/ */
inline CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {} inline CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {}

2
src/CubeMapTextureArray.h

@ -50,6 +50,7 @@ class CubeMapTextureArray: public AbstractTexture {
/** /**
* @brief Enable/disable seamless cube map textures * @brief Enable/disable seamless cube map textures
* *
* @see @fn_gl{Enable}/@fn_gl{Disable} with @def_gl{TEXTURE_CUBE_MAP_SEAMLESS}
* @requires_gl32 Extension @extension{ARB,seamless_cube_map} * @requires_gl32 Extension @extension{ARB,seamless_cube_map}
*/ */
inline static void setSeamless(bool enabled) { inline static void setSeamless(bool enabled) {
@ -60,6 +61,7 @@ class CubeMapTextureArray: public AbstractTexture {
* @brief Constructor * @brief Constructor
* *
* Creates one cube map OpenGL texture. * Creates one cube map OpenGL texture.
* @see @def_gl{TEXTURE_CUBE_MAP_ARRAY}
*/ */
inline CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {} inline CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {}

76
src/Framebuffer.h

@ -109,7 +109,11 @@ class MAGNUM_EXPORT Framebuffer {
FaceCulling = GL_CULL_FACE /**< Back face culling */ FaceCulling = GL_CULL_FACE /**< Back face culling */
}; };
/** @brief Set feature */ /**
* @brief Set feature
*
* @see @fn_gl{Enable}/@fn_gl{Disable}
*/
inline static void setFeature(Feature feature, bool enabled) { inline static void setFeature(Feature feature, bool enabled) {
enabled ? glEnable(static_cast<GLenum>(feature)) : glDisable(static_cast<GLenum>(feature)); enabled ? glEnable(static_cast<GLenum>(feature)) : glDisable(static_cast<GLenum>(feature));
} }
@ -120,6 +124,7 @@ class MAGNUM_EXPORT Framebuffer {
* Initial value is `PolygonFacing::Back`. If set to both front and * Initial value is `PolygonFacing::Back`. If set to both front and
* back, only points and lines are drawn. * back, only points and lines are drawn.
* @attention You have to also enable face culling with setFeature(). * @attention You have to also enable face culling with setFeature().
* @see @fn_gl{CullFace}
*/ */
inline static void setFaceCullingMode(PolygonFacing mode) { inline static void setFaceCullingMode(PolygonFacing mode) {
glCullFace(static_cast<GLenum>(mode)); glCullFace(static_cast<GLenum>(mode));
@ -129,7 +134,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Set viewport size * @brief Set viewport size
* *
* Call when window size changes. * Call when window size changes.
* @see Camera::setViewport() * @see @fn_gl{Viewport}
*/ */
inline static void setViewport(const Math::Vector2<GLint>& position, const Math::Vector2<GLsizei>& size) { inline static void setViewport(const Math::Vector2<GLint>& position, const Math::Vector2<GLsizei>& size) {
glViewport(position.x(), position.y(), size.x(), size.y()); glViewport(position.x(), position.y(), size.x(), size.y());
@ -157,7 +162,8 @@ class MAGNUM_EXPORT Framebuffer {
/** /**
* @brief Clear specified buffers in framebuffer * @brief Clear specified buffers in framebuffer
* *
* @see clear(), setClearColor(), setClearDepth(), setClearStencil() * @see clear(), setClearColor(), setClearDepth(), setClearStencil(),
* @fn_gl{Clear}
* @todo Clearing only given draw buffer * @todo Clearing only given draw buffer
*/ */
inline static void clear(ClearMask mask) { glClear(static_cast<GLbitfield>(mask)); } inline static void clear(ClearMask mask) { glClear(static_cast<GLbitfield>(mask)); }
@ -166,6 +172,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Set clear color * @brief Set clear color
* *
* Initial value is `{0.0f, 0.0f, 0.0f, 1.0f}`. * Initial value is `{0.0f, 0.0f, 0.0f, 1.0f}`.
* @see @fn_gl{ClearColor}
*/ */
inline static void setClearColor(const Color4<GLfloat>& color) { inline static void setClearColor(const Color4<GLfloat>& color) {
glClearColor(color.r(), color.g(), color.b(), color.a()); glClearColor(color.r(), color.g(), color.b(), color.a());
@ -176,6 +183,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Set clear depth * @brief Set clear depth
* *
* Initial value is `1.0`. * Initial value is `1.0`.
* @see @fn_gl{ClearDepth}
* @requires_gl See setClearDepth(GLfloat), which is supported in OpenGL ES. * @requires_gl See setClearDepth(GLfloat), which is supported in OpenGL ES.
*/ */
inline static void setClearDepth(GLdouble depth) { glClearDepth(depth); } inline static void setClearDepth(GLdouble depth) { glClearDepth(depth); }
@ -184,6 +192,7 @@ class MAGNUM_EXPORT Framebuffer {
/** /**
* @overload * @overload
* *
* @see @fn_gl{ClearDepth}
* @requires_gl41 Extension @extension{ARB,ES2_compatibility} * @requires_gl41 Extension @extension{ARB,ES2_compatibility}
*/ */
inline static void setClearDepth(GLfloat depth) { glClearDepthf(depth); } inline static void setClearDepth(GLfloat depth) { glClearDepthf(depth); }
@ -192,6 +201,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Set clear stencil * @brief Set clear stencil
* *
* Initial value is `0`. * Initial value is `0`.
* @see @fn_gl{ClearStencil}
*/ */
inline static void setClearStencil(GLint stencil) { glClearStencil(stencil); } inline static void setClearStencil(GLint stencil) { glClearStencil(stencil); }
@ -205,7 +215,9 @@ class MAGNUM_EXPORT Framebuffer {
* @param size Scissor rectangle size. Initial value is * @param size Scissor rectangle size. Initial value is
* size of the window when the context is first attached to a * size of the window when the context is first attached to a
* window. * window.
*
* @attention You have to enable scissoring with setFeature() first. * @attention You have to enable scissoring with setFeature() first.
* @see @fn_gl{Scissor}
*/ */
inline static void setScissor(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLsizei>& size) { inline static void setScissor(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLsizei>& size) {
glScissor(bottomLeft.x(), bottomLeft.y(), size.x(), size.y()); glScissor(bottomLeft.x(), bottomLeft.y(), size.x(), size.y());
@ -286,7 +298,8 @@ class MAGNUM_EXPORT Framebuffer {
* Initial value is all `1`s. * Initial value is all `1`s.
* *
* @attention You have to enable stencil test with setFeature() first. * @attention You have to enable stencil test with setFeature() first.
* @see setStencilFunction(StencilFunction, GLint, GLuint) * @see setStencilFunction(StencilFunction, GLint, GLuint),
* @fn_gl{StencilFuncSeparate}
*/ */
inline static void setStencilFunction(PolygonFacing facing, StencilFunction function, GLint referenceValue, GLuint mask) { inline static void setStencilFunction(PolygonFacing facing, StencilFunction function, GLint referenceValue, GLuint mask) {
glStencilFuncSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(function), referenceValue, mask); glStencilFuncSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(function), referenceValue, mask);
@ -297,6 +310,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* The same as setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint) * The same as setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint)
* with `facing` set to `PolygonFacing::FrontAndBack`. * with `facing` set to `PolygonFacing::FrontAndBack`.
* @see @fn_gl{StencilFunc}
*/ */
inline static void setStencilFunction(StencilFunction function, GLint referenceValue, GLuint mask) { inline static void setStencilFunction(StencilFunction function, GLint referenceValue, GLuint mask) {
glStencilFunc(static_cast<GLenum>(function), referenceValue, mask); glStencilFunc(static_cast<GLenum>(function), referenceValue, mask);
@ -313,7 +327,8 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Initial value for all fields is `StencilOperation::Keep`. * Initial value for all fields is `StencilOperation::Keep`.
* @attention You have to enable stencil test with setFeature() first. * @attention You have to enable stencil test with setFeature() first.
* @see setStencilOperation(StencilOperation, StencilOperation, StencilOperation) * @see setStencilOperation(StencilOperation, StencilOperation, StencilOperation),
* @fn_gl{StencilOpSeparate}
*/ */
inline static void setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass) { inline static void setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass) {
glStencilOpSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(stencilFail), static_cast<GLenum>(depthFail), static_cast<GLenum>(depthPass)); glStencilOpSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(stencilFail), static_cast<GLenum>(depthFail), static_cast<GLenum>(depthPass));
@ -324,6 +339,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* The same as setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation) * The same as setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation)
* with `facing` set to `PolygonFacing::FrontAndBack`. * with `facing` set to `PolygonFacing::FrontAndBack`.
* @see @fn_gl{StencilOp}
*/ */
inline static void setStencilOperation(StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass) { inline static void setStencilOperation(StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass) {
glStencilOp(static_cast<GLenum>(stencilFail), static_cast<GLenum>(depthFail), static_cast<GLenum>(depthPass)); glStencilOp(static_cast<GLenum>(stencilFail), static_cast<GLenum>(depthFail), static_cast<GLenum>(depthPass));
@ -345,6 +361,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Initial value is `DepthFunction::Less`. * Initial value is `DepthFunction::Less`.
* @attention You have to enable depth test with setFeature() first. * @attention You have to enable depth test with setFeature() first.
* @see @fn_gl{DepthFunc}
*/ */
inline static void setDepthFunction(DepthFunction function) { inline static void setDepthFunction(DepthFunction function) {
glDepthFunc(static_cast<GLenum>(function)); glDepthFunc(static_cast<GLenum>(function));
@ -359,6 +376,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Set to `false` to disallow writing to given color channel. Initial * Set to `false` to disallow writing to given color channel. Initial
* values are all `true`. * values are all `true`.
* @see @fn_gl{ColorMask}
* @todo Masking only given draw buffer * @todo Masking only given draw buffer
*/ */
inline static void setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha) { inline static void setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha) {
@ -370,6 +388,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Set to `false` to disallow writing to depth buffer. Initial value * Set to `false` to disallow writing to depth buffer. Initial value
* is `true`. * is `true`.
* @see @fn_gl{DepthMask}
*/ */
inline static void setDepthMask(GLboolean allow) { inline static void setDepthMask(GLboolean allow) {
glDepthMask(allow); glDepthMask(allow);
@ -380,7 +399,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Set given bit to `0` to disallow writing stencil value for given * Set given bit to `0` to disallow writing stencil value for given
* faces to it. Initial value is all `1`s. * faces to it. Initial value is all `1`s.
* @see setStencilMask(GLuint) * @see setStencilMask(GLuint), @fn_gl{StencilMaskSeparate}
*/ */
inline static void setStencilMask(PolygonFacing facing, GLuint allowBits) { inline static void setStencilMask(PolygonFacing facing, GLuint allowBits) {
glStencilMaskSeparate(static_cast<GLenum>(facing), allowBits); glStencilMaskSeparate(static_cast<GLenum>(facing), allowBits);
@ -391,6 +410,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* The same as setStencilMask(PolygonFacing, GLuint) with `facing` set * The same as setStencilMask(PolygonFacing, GLuint) with `facing` set
* to `PolygonFacing::FrontAndBack`. * to `PolygonFacing::FrontAndBack`.
* @see @fn_gl{StencilMask}
*/ */
inline static void setStencilMask(GLuint allowBits) { inline static void setStencilMask(GLuint allowBits) {
glStencilMask(allowBits); glStencilMask(allowBits);
@ -561,7 +581,8 @@ class MAGNUM_EXPORT Framebuffer {
* How to combine source color (pixel value) with destination color * How to combine source color (pixel value) with destination color
* (framebuffer). Initial value is `BlendEquation::Add`. * (framebuffer). Initial value is `BlendEquation::Add`.
* @attention You have to enable blending with setFeature() first. * @attention You have to enable blending with setFeature() first.
* @see setBlendEquation(BlendEquation, BlendEquation) * @see setBlendEquation(BlendEquation, BlendEquation),
* @fn_gl{BlendEquation}
*/ */
inline static void setBlendEquation(BlendEquation equation) { inline static void setBlendEquation(BlendEquation equation) {
glBlendEquation(static_cast<GLenum>(equation)); glBlendEquation(static_cast<GLenum>(equation));
@ -572,6 +593,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* See setBlendEquation(BlendEquation) for more information. * See setBlendEquation(BlendEquation) for more information.
* @attention You have to enable blending with setFeature() first. * @attention You have to enable blending with setFeature() first.
* @see @fn_gl{BlendEquationSeparate}
*/ */
inline static void setBlendEquation(BlendEquation rgb, BlendEquation alpha) { inline static void setBlendEquation(BlendEquation rgb, BlendEquation alpha) {
glBlendEquationSeparate(static_cast<GLenum>(rgb), static_cast<GLenum>(alpha)); glBlendEquationSeparate(static_cast<GLenum>(rgb), static_cast<GLenum>(alpha));
@ -586,7 +608,8 @@ class MAGNUM_EXPORT Framebuffer {
* `BlendFunction::Zero`. * `BlendFunction::Zero`.
* *
* @attention You have to enable blending with setFeature() first. * @attention You have to enable blending with setFeature() first.
* @see setBlendFunction(BlendFunction, BlendFunction, BlendFunction, BlendFunction) * @see setBlendFunction(BlendFunction, BlendFunction, BlendFunction, BlendFunction),
* @fn_gl{BlendFunc}
*/ */
inline static void setBlendFunction(BlendFunction source, BlendFunction destination) { inline static void setBlendFunction(BlendFunction source, BlendFunction destination) {
glBlendFunc(static_cast<GLenum>(source), static_cast<GLenum>(destination)); glBlendFunc(static_cast<GLenum>(source), static_cast<GLenum>(destination));
@ -597,6 +620,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* See setBlendFunction(BlendFunction, BlendFunction) for more information. * See setBlendFunction(BlendFunction, BlendFunction) for more information.
* @attention You have to enable blending with setFeature() first. * @attention You have to enable blending with setFeature() first.
* @see @fn_gl{BlendFuncSeparate}
*/ */
inline static void setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha) { inline static void setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha) {
glBlendFuncSeparate(static_cast<GLenum>(sourceRgb), static_cast<GLenum>(destinationRgb), static_cast<GLenum>(sourceAlpha), static_cast<GLenum>(destinationAlpha)); glBlendFuncSeparate(static_cast<GLenum>(sourceRgb), static_cast<GLenum>(destinationRgb), static_cast<GLenum>(sourceAlpha), static_cast<GLenum>(destinationAlpha));
@ -611,6 +635,7 @@ class MAGNUM_EXPORT Framebuffer {
* `BlendFunction::ConstantAlpha` and * `BlendFunction::ConstantAlpha` and
* `BlendFunction::OneMinusConstantAlpha`. * `BlendFunction::OneMinusConstantAlpha`.
* @attention You have to enable blending with setFeature() first. * @attention You have to enable blending with setFeature() first.
* @see @fn_gl{BlendColor}
*/ */
inline static void setBlendColor(const Color4<GLfloat>& color) { inline static void setBlendColor(const Color4<GLfloat>& color) {
glBlendColor(color.r(), color.g(), color.b(), color.a()); glBlendColor(color.r(), color.g(), color.b(), color.a());
@ -650,6 +675,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Set logical operation * @brief Set logical operation
* *
* @attention You have to enable logical operation with setFeature() first. * @attention You have to enable logical operation with setFeature() first.
* @see @fn_gl{LogicOp}
* @requires_gl Logic operations on framebuffer are in desktop OpenGL only. * @requires_gl Logic operations on framebuffer are in desktop OpenGL only.
*/ */
inline static void setLogicOperation(LogicOperation operation) { inline static void setLogicOperation(LogicOperation operation) {
@ -727,6 +753,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Constructor * @brief Constructor
* *
* Generates new OpenGL framebuffer. * Generates new OpenGL framebuffer.
* @see @fn_gl{GenFramebuffers}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline Framebuffer() { glGenFramebuffers(1, &framebuffer); } inline Framebuffer() { glGenFramebuffers(1, &framebuffer); }
@ -735,6 +762,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Destructor * @brief Destructor
* *
* Deletes associated OpenGL framebuffer. * Deletes associated OpenGL framebuffer.
* @see @fn_gl{DeleteFramebuffers}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline ~Framebuffer() { glDeleteFramebuffers(1, &framebuffer); } inline ~Framebuffer() { glDeleteFramebuffers(1, &framebuffer); }
@ -743,6 +771,7 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Bind default framebuffer to given target * @brief Bind default framebuffer to given target
* @param target %Target * @param target %Target
* *
* @see @fn_gl{BindFramebuffer}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline static void bindDefault(Target target) { inline static void bindDefault(Target target) {
@ -752,6 +781,7 @@ class MAGNUM_EXPORT Framebuffer {
/** /**
* @brief Bind framebuffer * @brief Bind framebuffer
* *
* @see @fn_gl{BindFramebuffer}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void bind(Target target) { inline void bind(Target target) {
@ -769,7 +799,7 @@ class MAGNUM_EXPORT Framebuffer {
* If used for blit(), the order is not important. Each used attachment * If used for blit(), the order is not important. Each used attachment
* should have either renderbuffer or texture attached for writing to * should have either renderbuffer or texture attached for writing to
* work properly. * work properly.
* @see mapForDraw(), mapDefaultForRead() * @see mapForDraw(), mapDefaultForRead(), bindDefault(), @fn_gl{DrawBuffers}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -785,7 +815,7 @@ class MAGNUM_EXPORT Framebuffer {
* If used for blit(), the order is not important. Each used attachment * If used for blit(), the order is not important. Each used attachment
* should have either renderbuffer or texture attached for writing to * should have either renderbuffer or texture attached for writing to
* work properly. * work properly.
* @see mapDefaultForDraw(), mapForRead() * @see mapDefaultForDraw(), mapForRead(), bind(), @fn_gl{DrawBuffers}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -797,7 +827,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* Each used attachment should have either renderbuffer or texture * Each used attachment should have either renderbuffer or texture
* attached to work properly. * attached to work properly.
* @see mapForRead(), mapDefaultForDraw() * @see mapForRead(), mapDefaultForDraw(), bindDefault(), @fn_gl{ReadBuffer}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -812,7 +842,7 @@ class MAGNUM_EXPORT Framebuffer {
* *
* The color attachment should have either renderbuffer or texture * The color attachment should have either renderbuffer or texture
* attached for reading to work properly. * attached for reading to work properly.
* @see mapDefaultForRead(), mapForDraw() * @see mapDefaultForRead(), mapForDraw(), bind(), @fn_gl{ReadBuffer}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -854,8 +884,9 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Attach renderbuffer to given framebuffer depth/stencil attachment * @brief Attach renderbuffer to given framebuffer depth/stencil attachment
* @param target %Target * @param target %Target
* @param depthStencilAttachment Depth/stencil attachment * @param depthStencilAttachment Depth/stencil attachment
* @param renderbuffer Renderbuffer * @param renderbuffer %Renderbuffer
* *
* @see bind(), @fn_gl{FramebufferRenderbuffer}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachRenderbuffer(Target target, DepthStencilAttachment depthStencilAttachment, Renderbuffer* renderbuffer) { inline void attachRenderbuffer(Target target, DepthStencilAttachment depthStencilAttachment, Renderbuffer* renderbuffer) {
@ -868,8 +899,9 @@ class MAGNUM_EXPORT Framebuffer {
* @brief Attach renderbuffer to given framebuffer color attachment * @brief Attach renderbuffer to given framebuffer color attachment
* @param target %Target * @param target %Target
* @param colorAttachment Color attachment ID (number between 0 and 15) * @param colorAttachment Color attachment ID (number between 0 and 15)
* @param renderbuffer Renderbuffer * @param renderbuffer %Renderbuffer
* *
* @see bind(), @fn_gl{FramebufferRenderbuffer}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachRenderbuffer(Target target, unsigned int colorAttachment, Renderbuffer* renderbuffer) { inline void attachRenderbuffer(Target target, unsigned int colorAttachment, Renderbuffer* renderbuffer) {
@ -886,6 +918,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param texture 1D texture * @param texture 1D texture
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see bind(), @fn_gl{FramebufferTexture}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -903,6 +936,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param texture 1D texture * @param texture 1D texture
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see bind(), @fn_gl{FramebufferTexture}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -922,7 +956,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level. For rectangle textures it * @param mipLevel Mip level. For rectangle textures it
* should be always 0. * should be always 0.
* *
* @see attachCubeMapTexture() * @see attachCubeMapTexture(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachTexture2D(Target target, DepthStencilAttachment depthStencilAttachment, Texture2D* texture, GLint mipLevel) { inline void attachTexture2D(Target target, DepthStencilAttachment depthStencilAttachment, Texture2D* texture, GLint mipLevel) {
@ -940,7 +974,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level. For rectangle textures it * @param mipLevel Mip level. For rectangle textures it
* should be always 0. * should be always 0.
* *
* @see attachCubeMapTexture() * @see attachCubeMapTexture(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachTexture2D(Target target, unsigned int colorAttachment, Texture2D* texture, GLint mipLevel) { inline void attachTexture2D(Target target, unsigned int colorAttachment, Texture2D* texture, GLint mipLevel) {
@ -958,7 +992,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param coordinate Cube map coordinate * @param coordinate Cube map coordinate
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see attachTexture2D() * @see attachTexture2D(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachCubeMapTexture(Target target, DepthStencilAttachment depthStencilAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) { inline void attachCubeMapTexture(Target target, DepthStencilAttachment depthStencilAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) {
@ -975,7 +1009,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param coordinate Cube map coordinate * @param coordinate Cube map coordinate
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see attachTexture2D() * @see attachTexture2D(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachCubeMapTexture(Target target, unsigned int colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) { inline void attachCubeMapTexture(Target target, unsigned int colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) {
@ -993,6 +1027,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level * @param mipLevel Mip level
* @param layer Layer of 2D image within a 3D texture * @param layer Layer of 2D image within a 3D texture
* *
* @see bind(), @fn_gl{FramebufferTexture}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -1011,6 +1046,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level * @param mipLevel Mip level
* @param layer Layer of 2D image within a 3D texture. * @param layer Layer of 2D image within a 3D texture.
* *
* @see bind(), @fn_gl{FramebufferTexture}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
@ -1065,6 +1101,7 @@ class MAGNUM_EXPORT Framebuffer {
* mapDefaultForDraw() for binding particular framebuffer for reading * mapDefaultForDraw() for binding particular framebuffer for reading
* and drawing. If multiple attachments are specified in mapForDraw() * and drawing. If multiple attachments are specified in mapForDraw()
* / mapDefaultForDraw(), the data are written to each of them. * / mapDefaultForDraw(), the data are written to each of them.
* @see @fn_gl{BlitFramebuffer}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_blit} * @requires_gl30 Extension @extension{EXT,framebuffer_blit}
*/ */
@ -1085,6 +1122,7 @@ class MAGNUM_EXPORT Framebuffer {
* no interpolation is needed and thus * no interpolation is needed and thus
* AbstractTexture::Filter::NearestNeighbor filtering is used by * AbstractTexture::Filter::NearestNeighbor filtering is used by
* default. * default.
* @see @fn_gl{BlitFramebuffer}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_blit} * @requires_gl30 Extension @extension{EXT,framebuffer_blit}
*/ */
@ -1101,6 +1139,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param type Data type * @param type Data type
* @param image %Image where to put the data * @param image %Image where to put the data
* *
* @see @fn_gl{ReadPixels}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
static void read(const Math::Vector2<GLint>& offset, const Math::Vector2<GLsizei>& dimensions, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image); static void read(const Math::Vector2<GLint>& offset, const Math::Vector2<GLsizei>& dimensions, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image);
@ -1115,6 +1154,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param image Buffered image where to put the data * @param image Buffered image where to put the data
* @param usage %Buffer usage * @param usage %Buffer usage
* *
* @see Buffer::bind(Target), @fn_gl{ReadPixels}
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */

14
src/IndexedMesh.h

@ -69,12 +69,22 @@ class MAGNUM_EXPORT IndexedMesh: public Mesh {
*/ */
inline Buffer* indexBuffer() { return &_indexBuffer; } inline Buffer* indexBuffer() { return &_indexBuffer; }
/**
* @brief Draw the mesh
*
* Expects an active shader with all uniforms set.
* @see Buffer::bind(), bind(), unbind(), finalize(), @fn_gl{DrawElements}
* @todo Index buffer bound every time?!
*/
void draw(); void draw();
protected: protected:
#ifndef DOXYGEN_GENERATING_OUTPUT /**
* @brief Finalize the mesh
*
* @see Mesh::finalize(), Buffer::bind()
*/
MAGNUM_LOCAL void finalize(); MAGNUM_LOCAL void finalize();
#endif
private: private:
Buffer _indexBuffer; Buffer _indexBuffer;

41
src/Mesh.h

@ -69,6 +69,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Set front-facing polygon winding * @brief Set front-facing polygon winding
* *
* Initial value is `FrontFace::%CounterClockWise`. * Initial value is `FrontFace::%CounterClockWise`.
* @see @fn_gl{FrontFace}
*/ */
void setFrontFace(FrontFace mode) { void setFrontFace(FrontFace mode) {
glFrontFace(static_cast<GLenum>(mode)); glFrontFace(static_cast<GLenum>(mode));
@ -96,6 +97,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Set provoking vertex * @brief Set provoking vertex
* *
* Initial value is <tt>ProvokingMode::%LastVertexConvention</tt>. * Initial value is <tt>ProvokingMode::%LastVertexConvention</tt>.
* @see @fn_gl{ProvokingVertex}
* @requires_gl OpenGL ES behaves always like the default. * @requires_gl OpenGL ES behaves always like the default.
* @requires_gl32 Extension @extension{ARB,provoking_vertex}. Older * @requires_gl32 Extension @extension{ARB,provoking_vertex}. Older
* versions behave always like the default. * versions behave always like the default.
@ -137,6 +139,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Set polygon drawing mode * @brief Set polygon drawing mode
* *
* Initial value is `PolygonMode::%Fill`. * Initial value is `PolygonMode::%Fill`.
* @see @fn_gl{PolygonMode}
* @requires_gl OpenGL ES behaves always like the default. See * @requires_gl OpenGL ES behaves always like the default. See
* setPrimitive() for possible workaround. * setPrimitive() for possible workaround.
*/ */
@ -171,7 +174,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Enable/disable polygon offset for given mode * @brief Enable/disable polygon offset for given mode
* *
* Initially disabled for all modes. * Initially disabled for all modes.
* @see setPolygonOffset() * @see setPolygonOffset(), @fn_gl{Enable}/@fn_gl{Disable}
*/ */
inline static void setPolygonOffsetMode(PolygonOffsetMode mode, bool enabled) { inline static void setPolygonOffsetMode(PolygonOffsetMode mode, bool enabled) {
enabled ? glEnable(static_cast<GLenum>(mode)) : glDisable(static_cast<GLenum>(mode)); enabled ? glEnable(static_cast<GLenum>(mode)) : glDisable(static_cast<GLenum>(mode));
@ -184,6 +187,7 @@ class MAGNUM_EXPORT Mesh {
* *
* @attention You have to call setPolygonOffsetMode() to enable * @attention You have to call setPolygonOffsetMode() to enable
* polygon offset for desired polygon modes. * polygon offset for desired polygon modes.
* @see @fn_gl{PolygonOffset}
*/ */
inline static void setPolygonOffset(GLfloat factor, GLfloat units) { inline static void setPolygonOffset(GLfloat factor, GLfloat units) {
glPolygonOffset(factor, units); glPolygonOffset(factor, units);
@ -192,7 +196,8 @@ class MAGNUM_EXPORT Mesh {
/** /**
* @brief Set line width * @brief Set line width
* *
* Initial value is 1. * Initial value is `1.0f`.
* @see @fn_gl{LineWidth}
*/ */
inline static void setLineWidth(GLfloat width) { inline static void setLineWidth(GLfloat width) {
glLineWidth(width); glLineWidth(width);
@ -203,7 +208,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Set point size * @brief Set point size
* *
* Initial value is `1.0f`. * Initial value is `1.0f`.
* @see setProgramPointSize() * @see setProgramPointSize(), @fn_gl{PointSize}
* @requires_gl Set directly in vertex shader using @c gl_PointSize * @requires_gl Set directly in vertex shader using @c gl_PointSize
* builtin variable. * builtin variable.
*/ */
@ -216,7 +221,7 @@ class MAGNUM_EXPORT Mesh {
* *
* If enabled, the point size is taken from vertex/geometry shader * If enabled, the point size is taken from vertex/geometry shader
* builtin `gl_PointSize`. Initially disabled on desktop OpenGL. * builtin `gl_PointSize`. Initially disabled on desktop OpenGL.
* @see setPointSize() * @see setPointSize(), @fn_gl{Enable}/@fn_gl{Disable} with @def_gl{PROGRAM_POINT_SIZE}
* @requires_gl Always enabled on OpenGL ES. * @requires_gl Always enabled on OpenGL ES.
*/ */
inline static void setProgramPointSize(bool enabled) { inline static void setProgramPointSize(bool enabled) {
@ -272,7 +277,7 @@ class MAGNUM_EXPORT Mesh {
}; };
/** /**
* @brief Buffer type * @brief %Buffer type
* *
* If storing more than one attribute data in the buffer, the data of * If storing more than one attribute data in the buffer, the data of
* one attribute can be either kept together or interleaved with data * one attribute can be either kept together or interleaved with data
@ -292,6 +297,7 @@ class MAGNUM_EXPORT Mesh {
* Allows creating the object without knowing anything about mesh * Allows creating the object without knowing anything about mesh
* data. Note that you have to call setVertexCount() manually for mesh * data. Note that you have to call setVertexCount() manually for mesh
* to draw properly. * to draw properly.
* @see @fn_gl{GenVertexArrays}
*/ */
inline Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0), finalized(false) { inline Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0), finalized(false) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -303,6 +309,8 @@ class MAGNUM_EXPORT Mesh {
* @brief Constructor * @brief Constructor
* @param primitive Primitive type * @param primitive Primitive type
* @param vertexCount Vertex count * @param vertexCount Vertex count
*
* @see @fn_gl{GenVertexArrays}
*/ */
inline Mesh(Primitive primitive, GLsizei vertexCount): _primitive(primitive), _vertexCount(vertexCount), finalized(false) { inline Mesh(Primitive primitive, GLsizei vertexCount): _primitive(primitive), _vertexCount(vertexCount), finalized(false) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -317,6 +325,7 @@ class MAGNUM_EXPORT Mesh {
* @brief Destructor * @brief Destructor
* *
* Deletes all associated buffers. * Deletes all associated buffers.
* @see @fn_gl{DeleteVertexArrays}
*/ */
inline virtual ~Mesh() { destroy(); } inline virtual ~Mesh() { destroy(); }
@ -391,18 +400,30 @@ class MAGNUM_EXPORT Mesh {
* @brief Draw the mesh * @brief Draw the mesh
* *
* Expects an active shader with all uniforms set. * Expects an active shader with all uniforms set.
* @see bind(), unbind(), finalize(), @fn_gl{DrawArrays}
*/ */
virtual void draw(); virtual void draw();
protected: protected:
#ifndef DOXYGEN_GENERATING_OUTPUT /**
/** @brief Bind all buffers */ * @brief Bind all buffers
*
* @see @fn_gl{EnableVertexAttribArray}, @fn_gl{VertexAttribPointer}
*/
void bindBuffers(); void bindBuffers();
/** @brief Bind vertex array or all buffers */ /**
* @brief Bind vertex array or all buffers
*
* @see @fn_gl{BindVertexArray} or bindBuffers()
*/
void bind(); void bind();
/** @brief Unbind vertex array or all buffers */ /**
* @brief Unbind vertex array or all buffers
*
* @see @fn_gl{BindVertexArray} or @fn_gl{DisableVertexAttribArray}
*/
void unbind(); void unbind();
/** /**
@ -410,9 +431,9 @@ class MAGNUM_EXPORT Mesh {
* *
* Computes location and stride of each attribute in its buffer. After * Computes location and stride of each attribute in its buffer. After
* this function is called, no new attribute can be bound. * this function is called, no new attribute can be bound.
* @see bindBuffers()
*/ */
MAGNUM_LOCAL void finalize(); MAGNUM_LOCAL void finalize();
#endif
private: private:
/** @brief Vertex attribute */ /** @brief Vertex attribute */

16
src/Query.h

@ -39,6 +39,7 @@ class MAGNUM_EXPORT AbstractQuery {
* @brief Constructor * @brief Constructor
* *
* Generates one OpenGL query. * Generates one OpenGL query.
* @see @fn_gl{GenQueries}
*/ */
inline AbstractQuery() { glGenQueries(1, &query); } inline AbstractQuery() { glGenQueries(1, &query); }
@ -46,11 +47,14 @@ class MAGNUM_EXPORT AbstractQuery {
* @brief Destructor * @brief Destructor
* *
* Deletes assigned OpenGL query. * Deletes assigned OpenGL query.
* @see @fn_gl{DeleteQueries}
*/ */
virtual inline ~AbstractQuery() { glDeleteQueries(1, &query); } virtual inline ~AbstractQuery() { glDeleteQueries(1, &query); }
/** /**
* @brief Whether the result is available * @brief Whether the result is available
*
* @see @fn_gl{GetQueryObject} with @def_gl{QUERY_RESULT_AVAILABLE}
*/ */
bool resultAvailable(); bool resultAvailable();
@ -61,7 +65,7 @@ class MAGNUM_EXPORT AbstractQuery {
* *
* Note that this function is blocking until the result is available. * Note that this function is blocking until the result is available.
* See resultAvailable(). * See resultAvailable().
* * @see @fn_gl{GetQueryObject} with @def_gl{QUERY_RESULT}
* @requires_gl33 Extension @extension{ARB,timer_query} (result type `GLuint64` and `GLint64`) * @requires_gl33 Extension @extension{ARB,timer_query} (result type `GLuint64` and `GLint64`)
*/ */
template<class T> T result(); template<class T> T result();
@ -130,6 +134,7 @@ class MAGNUM_EXPORT Query: public AbstractQuery {
* @brief Begin query * @brief Begin query
* *
* Begins counting of given @p target until end() is called. * Begins counting of given @p target until end() is called.
* @see @fn_gl{BeginQuery}
*/ */
void begin(Target target); void begin(Target target);
@ -137,6 +142,7 @@ class MAGNUM_EXPORT Query: public AbstractQuery {
* @brief End query * @brief End query
* *
* The result can be then retrieved by calling result(). * The result can be then retrieved by calling result().
* @see @fn_gl{EndQuery}
*/ */
void end(); void end();
@ -239,6 +245,7 @@ class MAGNUM_EXPORT SampleQuery: public AbstractQuery {
/** /**
* @brief Begin conditional rendering based on result value * @brief Begin conditional rendering based on result value
* *
* @see @fn_gl{BeginConditionalRender}
* @requires_gl30 Extension @extension{NV,conditional_render} * @requires_gl30 Extension @extension{NV,conditional_render}
*/ */
inline void beginConditionalRender(ConditionalRenderMode mode) { inline void beginConditionalRender(ConditionalRenderMode mode) {
@ -248,6 +255,7 @@ class MAGNUM_EXPORT SampleQuery: public AbstractQuery {
/** /**
* @brief End conditional render * @brief End conditional render
* *
* @see @fn_gl{EndConditionalRender}
* @requires_gl30 Extension @extension{NV,conditional_render} * @requires_gl30 Extension @extension{NV,conditional_render}
*/ */
inline void endConditionalRender() { inline void endConditionalRender() {
@ -293,7 +301,11 @@ Using this query results in fewer OpenGL calls when doing more measures.
*/ */
class TimeQuery: public AbstractQuery { class TimeQuery: public AbstractQuery {
public: public:
/** @brief Query timestamp */ /**
* @brief Query timestamp
*
* @see @fn_gl{QueryCounter} with @def_gl{TIMESTAMP}
*/
inline void timestamp() { inline void timestamp() {
glQueryCounter(query, GL_TIMESTAMP); glQueryCounter(query, GL_TIMESTAMP);
} }

10
src/Renderbuffer.h

@ -184,6 +184,7 @@ class Renderbuffer {
* @brief Constructor * @brief Constructor
* *
* Generates new OpenGL renderbuffer. * Generates new OpenGL renderbuffer.
* @see @fn_gl{GenRenderbuffers}
*/ */
inline Renderbuffer() { inline Renderbuffer() {
glGenRenderbuffers(1, &renderbuffer); glGenRenderbuffers(1, &renderbuffer);
@ -193,6 +194,7 @@ class Renderbuffer {
* @brief Destructor * @brief Destructor
* *
* Deletes associated OpenGL renderbuffer. * Deletes associated OpenGL renderbuffer.
* @see @fn_gl{DeleteRenderbuffers}
*/ */
inline ~Renderbuffer() { inline ~Renderbuffer() {
glDeleteRenderbuffers(1, &renderbuffer); glDeleteRenderbuffers(1, &renderbuffer);
@ -201,7 +203,11 @@ class Renderbuffer {
/** @brief OpenGL internal renderbuffer ID */ /** @brief OpenGL internal renderbuffer ID */
inline GLuint id() const { return renderbuffer; } inline GLuint id() const { return renderbuffer; }
/** @brief Bind renderbuffer */ /**
* @brief Bind renderbuffer
*
* @see @fn_gl{BindRenderbuffer}
*/
inline void bind() { inline void bind() {
glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
} }
@ -210,6 +216,8 @@ class Renderbuffer {
* @brief Set renderbuffer storage * @brief Set renderbuffer storage
* @param internalFormat Internal format * @param internalFormat Internal format
* @param size Renderbuffer size * @param size Renderbuffer size
*
* @see bind(), @fn_gl{RenderbufferStorage}
*/ */
inline void setStorage(InternalFormat internalFormat, const Math::Vector2<GLsizei>& size) { inline void setStorage(InternalFormat internalFormat, const Math::Vector2<GLsizei>& size) {
bind(); bind();

7
src/Shader.h

@ -122,7 +122,7 @@ class MAGNUM_EXPORT Shader {
* *
* Creates empty OpenGL shader. Sources can be added with addSource() * Creates empty OpenGL shader. Sources can be added with addSource()
* or addFile(). * or addFile().
* @see fromData(), fromFile() * @see fromData(), fromFile(), @fn_gl{CreateShader}
*/ */
inline Shader(Type type): _type(type), _state(State::Initialized), shader(0) { inline Shader(Type type): _type(type), _state(State::Initialized), shader(0) {
shader = glCreateShader(static_cast<GLenum>(_type)); shader = glCreateShader(static_cast<GLenum>(_type));
@ -132,6 +132,7 @@ class MAGNUM_EXPORT Shader {
* @brief Destructor * @brief Destructor
* *
* Deletes associated OpenGL shader. * Deletes associated OpenGL shader.
* @see @fn_gl{DeleteShader}
*/ */
inline ~Shader() { if(shader) glDeleteShader(shader); } inline ~Shader() { if(shader) glDeleteShader(shader); }
@ -185,7 +186,9 @@ class MAGNUM_EXPORT Shader {
* before, it tries to compile it. If compilation fails or no sources * before, it tries to compile it. If compilation fails or no sources
* are present, returns 0. If the shader was compiled already, returns * are present, returns 0. If the shader was compiled already, returns
* already existing shader. * already existing shader.
* @see state() * @see state(), @fn_gl{ShaderSource}, @fn_gl{CompileShader},
* @fn_gl{GetShader} with @def_gl{COMPILE_STATUS},
* @fn_gl{GetShaderInfoLog}
*/ */
GLuint compile(); GLuint compile();

4
src/Texture.h

@ -122,6 +122,8 @@ template<size_t textureDimensions> class Texture: public AbstractTexture {
* @attention For rectangle textures only some modes are supported, * @attention For rectangle textures only some modes are supported,
* see @ref AbstractTexture::Wrapping "Wrapping" documentation for * see @ref AbstractTexture::Wrapping "Wrapping" documentation for
* more information. * more information.
* @see bind(), @fn_gl{TexParameter} with @def_gl{TEXTURE_WRAP_S},
* @def_gl{TEXTURE_WRAP_T}, @def_gl{TEXTURE_WRAP_R}
*/ */
inline Texture<Dimensions>* setWrapping(const Math::Vector<Dimensions, Wrapping>& wrapping) { inline Texture<Dimensions>* setWrapping(const Math::Vector<Dimensions, Wrapping>& wrapping) {
bind(); bind();
@ -139,6 +141,7 @@ template<size_t textureDimensions> class Texture: public AbstractTexture {
* *
* Sets texture data from given image. The image is not deleted * Sets texture data from given image. The image is not deleted
* afterwards. * afterwards.
* @see bind(), @fn_gl{TexImage1D}, @fn_gl{TexImage2D}, @fn_gl{TexImage3D}
*/ */
template<class Image> inline Texture<Dimensions>* setData(GLint mipLevel, InternalFormat internalFormat, Image* image) { template<class Image> inline Texture<Dimensions>* setData(GLint mipLevel, InternalFormat internalFormat, Image* image) {
bind(); bind();
@ -162,6 +165,7 @@ template<size_t textureDimensions> class Texture: public AbstractTexture {
* taken as if it had the last dimension equal to 1. It can be used * taken as if it had the last dimension equal to 1. It can be used
* for e.g. updating 3D texture with multiple 2D images or for filling * for e.g. updating 3D texture with multiple 2D images or for filling
* 1D texture array (which is two-dimensional) with 1D images. * 1D texture array (which is two-dimensional) with 1D images.
* @see bind(), @fn_gl{TexSubImage1D}, @fn_gl{TexSubImage2D}, @fn_gl{TexSubImage3D}
*/ */
template<class Image> inline Texture<Dimensions>* setSubData(GLint mipLevel, const Math::Vector<Dimensions, GLint>& offset, Image* image) { template<class Image> inline Texture<Dimensions>* setSubData(GLint mipLevel, const Math::Vector<Dimensions, GLint>& offset, Image* image) {
bind(); bind();

Loading…
Cancel
Save