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.
828 lines
41 KiB
828 lines
41 KiB
|
8 years ago
|
#ifndef Magnum_GL_AbstractFramebuffer_h
|
||
|
|
#define Magnum_GL_AbstractFramebuffer_h
|
||
|
14 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.
|
||
|
14 years ago
|
|
||
|
13 years ago
|
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.
|
||
|
14 years ago
|
*/
|
||
|
|
|
||
|
|
/** @file
|
||
|
13 years ago
|
* @brief Class @ref Magnum::AbstractFramebuffer, enum @ref Magnum::FramebufferClear, @ref Magnum::FramebufferBlit, @ref Magnum::FramebufferBlitFilter, @ref Magnum::FramebufferTarget, enum set @ref Magnum::FramebufferClearMask
|
||
|
14 years ago
|
*/
|
||
|
|
|
||
|
12 years ago
|
#include <Corrade/Containers/EnumSet.h>
|
||
|
14 years ago
|
|
||
|
8 years ago
|
#include "Magnum/GL/GL.h"
|
||
|
|
#include "Magnum/GL/AbstractObject.h"
|
||
|
12 years ago
|
#include "Magnum/Math/Range.h"
|
||
|
14 years ago
|
|
||
|
|
namespace Magnum {
|
||
|
|
|
||
|
13 years ago
|
/**
|
||
|
13 years ago
|
@brief Mask for framebuffer clearing
|
||
|
|
|
||
|
13 years ago
|
@see @ref AbstractFramebuffer, @ref FramebufferClearMask
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
enum class FramebufferClear: GLbitfield {
|
||
|
12 years ago
|
Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */
|
||
|
|
Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */
|
||
|
|
Stencil = GL_STENCIL_BUFFER_BIT /**< Stencil buffer */
|
||
|
13 years ago
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
13 years ago
|
@brief Mask for clearing
|
||
|
|
|
||
|
13 years ago
|
@see @ref AbstractFramebuffer::clear()
|
||
|
13 years ago
|
*/
|
||
|
12 years ago
|
#ifndef DOXYGEN_GENERATING_OUTPUT
|
||
|
12 years ago
|
typedef Containers::EnumSet<FramebufferClear,
|
||
|
13 years ago
|
GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT> FramebufferClearMask;
|
||
|
12 years ago
|
#else
|
||
|
|
typedef Containers::EnumSet<FramebufferClear> FramebufferClearMask;
|
||
|
|
#endif
|
||
|
13 years ago
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
13 years ago
|
/**
|
||
|
13 years ago
|
@brief Mask for framebuffer blitting
|
||
|
|
|
||
|
13 years ago
|
@see @ref AbstractFramebuffer, @ref FramebufferBlitMask
|
||
|
8 years ago
|
@m_enum_values_as_keywords
|
||
|
12 years ago
|
@requires_gl30 Extension @extension{ARB,framebuffer_object}
|
||
|
9 years ago
|
@requires_gles30 Extension @extension{ANGLE,framebuffer_blit} or
|
||
|
|
@extension{NV,framebuffer_blit} in OpenGL ES 2.0.
|
||
|
11 years ago
|
@requires_webgl20 Framebuffer blit is not available in WebGL 1.0.
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
enum class FramebufferBlit: GLbitfield {
|
||
|
12 years ago
|
Color = GL_COLOR_BUFFER_BIT, /**< Color buffer */
|
||
|
|
Depth = GL_DEPTH_BUFFER_BIT, /**< Depth buffer */
|
||
|
|
Stencil = GL_STENCIL_BUFFER_BIT /**< Stencil buffer */
|
||
|
13 years ago
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
13 years ago
|
@brief Mask for framebuffer blitting
|
||
|
|
|
||
|
13 years ago
|
@see @ref AbstractFramebuffer::blit()
|
||
|
12 years ago
|
@requires_gl30 Extension @extension{ARB,framebuffer_object}
|
||
|
9 years ago
|
@requires_gles30 Extension @extension{ANGLE,framebuffer_blit} or
|
||
|
|
@extension{NV,framebuffer_blit} in OpenGL ES 2.0.
|
||
|
11 years ago
|
@requires_webgl20 Framebuffer blit is not available in WebGL 1.0.
|
||
|
13 years ago
|
*/
|
||
|
12 years ago
|
#ifndef DOXYGEN_GENERATING_OUTPUT
|
||
|
12 years ago
|
typedef Containers::EnumSet<FramebufferBlit,
|
||
|
13 years ago
|
GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT> FramebufferBlitMask;
|
||
|
12 years ago
|
#else
|
||
|
|
typedef Containers::EnumSet<FramebufferBlit> FramebufferBlitMask;
|
||
|
|
#endif
|
||
|
13 years ago
|
|
||
|
|
/**
|
||
|
12 years ago
|
@brief Framebuffer blit filtering
|
||
|
13 years ago
|
|
||
|
13 years ago
|
@see @ref AbstractFramebuffer::blit()
|
||
|
8 years ago
|
@m_enum_values_as_keywords
|
||
|
12 years ago
|
@requires_gl30 Extension @extension{ARB,framebuffer_object}
|
||
|
9 years ago
|
@requires_gles30 Extension @extension{ANGLE,framebuffer_blit} or
|
||
|
|
@extension{NV,framebuffer_blit} in OpenGL ES 2.0.
|
||
|
11 years ago
|
@requires_webgl20 Framebuffer blit is not available in WebGL 1.0.
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
enum class FramebufferBlitFilter: GLenum {
|
||
|
|
Nearest = GL_NEAREST, /**< Nearest neighbor filtering */
|
||
|
|
Linear = GL_LINEAR /**< Linear interpolation filtering */
|
||
|
|
};
|
||
|
11 years ago
|
#endif
|
||
|
13 years ago
|
|
||
|
|
/**
|
||
|
11 years ago
|
@brief Framebuffer target
|
||
|
13 years ago
|
|
||
|
11 years ago
|
@see @ref DefaultFramebuffer::checkStatus(), @ref Framebuffer::checkStatus()
|
||
|
8 years ago
|
@m_enum_values_as_keywords
|
||
|
12 years ago
|
@requires_gl30 Extension @extension{ARB,framebuffer_object}
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
enum class FramebufferTarget: GLenum {
|
||
|
11 years ago
|
/** Frambebuffer reading target */
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
Read = GL_READ_FRAMEBUFFER,
|
||
|
11 years ago
|
#elif !defined(MAGNUM_TARGET_WEBGL)
|
||
|
13 years ago
|
Read = GL_READ_FRAMEBUFFER_APPLE,
|
||
|
11 years ago
|
#else
|
||
|
|
Read,
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
11 years ago
|
/** Framebuffer drawing target */
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
Draw = GL_DRAW_FRAMEBUFFER,
|
||
|
11 years ago
|
#elif !defined(MAGNUM_TARGET_WEBGL)
|
||
|
13 years ago
|
Draw = GL_DRAW_FRAMEBUFFER_APPLE,
|
||
|
11 years ago
|
#else
|
||
|
|
Draw,
|
||
|
13 years ago
|
#endif
|
||
|
|
};
|
||
|
|
|
||
|
12 years ago
|
namespace Implementation { struct FramebufferState; }
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
|
@brief Base for default and named framebuffers
|
||
|
|
|
||
|
13 years ago
|
See @ref DefaultFramebuffer and @ref Framebuffer for more information.
|
||
|
14 years ago
|
|
||
|
8 years ago
|
@section AbstractFramebuffer-performance-optimization Performance optimizations and security
|
||
|
14 years ago
|
|
||
|
14 years ago
|
The engine tracks currently bound framebuffer and current viewport to avoid
|
||
|
8 years ago
|
unnecessary calls to @fn_gl_keyword{BindFramebuffer} and @fn_gl{Viewport} when
|
||
|
12 years ago
|
switching framebuffers. Framebuffer limits and implementation-defined values
|
||
|
13 years ago
|
(such as @ref maxViewportSize()) are cached, so repeated queries don't result
|
||
|
11 years ago
|
in repeated @fn_gl{Get} calls. See also @ref Context::resetState() and
|
||
|
|
@ref Context::State::Framebuffers.
|
||
|
14 years ago
|
|
||
|
12 years ago
|
If extension @extension{ARB,direct_state_access} (part of OpenGL 4.5) is
|
||
|
9 years ago
|
available, @ref blit(), @ref clearDepth(), @ref clearStencil() and
|
||
|
|
@ref clearDepthStencil() functions use DSA to avoid unnecessary call to
|
||
|
|
@fn_gl{BindFramebuffer}. See their documentation for more information.
|
||
|
12 years ago
|
|
||
|
13 years ago
|
If @extension{ARB,robustness} is available, @ref read() operations are
|
||
|
|
protected from buffer overflow.
|
||
|
14 years ago
|
*/
|
||
|
8 years ago
|
class MAGNUM_GL_EXPORT AbstractFramebuffer {
|
||
|
12 years ago
|
friend Implementation::FramebufferState;
|
||
|
14 years ago
|
|
||
|
14 years ago
|
public:
|
||
|
13 years ago
|
/** @todo `GL_IMPLEMENTATION_COLOR_READ_FORMAT`, `GL_IMPLEMENTATION_COLOR_READ_TYPE`, seems to be depending on currently bound FB (aargh) (@extension{ARB,ES2_compatibility}). */
|
||
|
13 years ago
|
|
||
|
|
/**
|
||
|
|
* @brief Max supported viewport size
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
|
* OpenGL calls.
|
||
|
8 years ago
|
* @see @ref setViewport(), @fn_gl{Get} with
|
||
|
|
* @def_gl_keyword{MAX_VIEWPORT_DIMS}
|
||
|
13 years ago
|
*/
|
||
|
|
static Vector2i maxViewportSize();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Max supported draw buffer count
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
9 years ago
|
* OpenGL calls. If neither @extension{EXT,draw_buffers} nor
|
||
|
|
* @extension{NV,draw_buffers} is available in OpenGL ES 2.0 and
|
||
|
11 years ago
|
* @webgl_extension{WEBGL,draw_buffers} is not available in WebGL 1.0,
|
||
|
|
* returns `0`.
|
||
|
13 years ago
|
* @see @ref DefaultFramebuffer::mapForDraw(), @ref Framebuffer::mapForDraw(),
|
||
|
8 years ago
|
* @fn_gl{Get} with @def_gl_keyword{MAX_DRAW_BUFFERS}
|
||
|
13 years ago
|
*/
|
||
|
|
static Int maxDrawBuffers();
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Max supported dual-source draw buffer count
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
12 years ago
|
* OpenGL calls. If extension @extension{ARB,blend_func_extended} (part
|
||
|
|
* of OpenGL 3.3) is not available, returns `0`.
|
||
|
13 years ago
|
* @see @ref DefaultFramebuffer::mapForDraw(), @ref Framebuffer::mapForDraw(),
|
||
|
8 years ago
|
* @fn_gl{Get} with @def_gl_keyword{MAX_DUAL_SOURCE_DRAW_BUFFERS}
|
||
|
13 years ago
|
* @requires_gl Multiple blending inputs are not available in
|
||
|
11 years ago
|
* OpenGL ES or WebGL.
|
||
|
13 years ago
|
*/
|
||
|
|
static Int maxDualSourceDrawBuffers();
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
14 years ago
|
/**
|
||
|
|
* @brief Copy block of pixels
|
||
|
|
* @param source Source framebuffer
|
||
|
|
* @param destination Destination framebuffer
|
||
|
14 years ago
|
* @param sourceRectangle Source rectangle
|
||
|
|
* @param destinationRectangle Destination rectangle
|
||
|
14 years ago
|
* @param mask Which buffers to perform blit operation on
|
||
|
|
* @param filter Interpolation filter
|
||
|
|
*
|
||
|
12 years ago
|
* See @ref DefaultFramebuffer::mapForRead(), @ref Framebuffer::mapForRead(),
|
||
|
|
* @ref DefaultFramebuffer::mapForDraw() and @ref Framebuffer::mapForDraw()
|
||
|
|
* for specifying particular buffers for blitting operation. If
|
||
|
|
* @extension{ARB,direct_state_access} (part of OpenGL 4.5) is not
|
||
|
|
* available, @p source framebuffer is bound to @ref FramebufferTarget::Read
|
||
|
|
* and @p destination framebuffer to @ref FramebufferTarget::Draw
|
||
|
|
* before the operation (if not already).
|
||
|
8 years ago
|
* @see @fn_gl2_keyword{BlitNamedFramebuffer,BlitFramebuffer}, eventually
|
||
|
|
* @fn_gl_keyword{BlitFramebuffer}
|
||
|
9 years ago
|
* @requires_gles30 Extension @extension{ANGLE,framebuffer_blit} or
|
||
|
|
* @extension{NV,framebuffer_blit} in OpenGL ES 2.0.
|
||
|
11 years ago
|
* @requires_webgl20 Framebuffer blit is not available in WebGL 1.0.
|
||
|
14 years ago
|
*/
|
||
|
13 years ago
|
static void blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter);
|
||
|
14 years ago
|
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels
|
||
|
|
*
|
||
|
12 years ago
|
* Convenience alternative to the above function when source rectangle
|
||
|
|
* is the same as destination rectangle. As the image is copied
|
||
|
14 years ago
|
* pixel-by-pixel, no interpolation is needed and thus
|
||
|
13 years ago
|
* @ref FramebufferBlitFilter::Nearest filtering is used by default.
|
||
|
14 years ago
|
*/
|
||
|
13 years ago
|
static void blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& rectangle, FramebufferBlitMask mask) {
|
||
|
13 years ago
|
blit(source, destination, rectangle, rectangle, mask, FramebufferBlitFilter::Nearest);
|
||
|
14 years ago
|
}
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
/**
|
||
|
11 years ago
|
* @brief Bind framebuffer for drawing
|
||
|
14 years ago
|
*
|
||
|
11 years ago
|
* Binds the framebuffer for drawing and updates viewport to saved
|
||
|
|
* dimensions.
|
||
|
13 years ago
|
* @see @ref setViewport(), @ref DefaultFramebuffer::mapForRead(),
|
||
|
|
* @ref Framebuffer::mapForRead(), @ref DefaultFramebuffer::mapForDraw(),
|
||
|
8 years ago
|
* @ref Framebuffer::mapForDraw(), @fn_gl_keyword{BindFramebuffer},
|
||
|
14 years ago
|
* @fn_gl{Viewport}
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
void bind();
|
||
|
|
|
||
|
14 years ago
|
/** @brief Viewport rectangle */
|
||
|
13 years ago
|
Range2Di viewport() const { return _viewport; }
|
||
|
14 years ago
|
|
||
|
14 years ago
|
/**
|
||
|
14 years ago
|
* @brief Set viewport
|
||
|
13 years ago
|
* @return Reference to self (for method chaining)
|
||
|
14 years ago
|
*
|
||
|
13 years ago
|
* Saves the viewport to be used at later time in @ref bind(). If the
|
||
|
14 years ago
|
* framebuffer is currently bound, updates the viewport to given
|
||
|
11 years ago
|
* rectangle. Initial value in @ref DefaultFramebuffer is set to cover
|
||
|
|
* whole window, in @ref Framebuffer the initial value is specified in
|
||
|
|
* constructor.
|
||
|
8 years ago
|
* @see @ref maxViewportSize(), @fn_gl_keyword{Viewport}
|
||
|
14 years ago
|
*/
|
||
|
13 years ago
|
AbstractFramebuffer& setViewport(const Range2Di& rectangle);
|
||
|
14 years ago
|
|
||
|
|
/**
|
||
|
|
* @brief Clear specified buffers in framebuffer
|
||
|
|
* @param mask Which buffers to clear
|
||
|
11 years ago
|
* @return Reference to self (for method chaining)
|
||
|
14 years ago
|
*
|
||
|
14 years ago
|
* To improve performance you can also use
|
||
|
13 years ago
|
* @ref DefaultFramebuffer::invalidate() / @ref Framebuffer::invalidate()
|
||
|
|
* instead of clearing given buffer if you will not use it anymore or
|
||
|
|
* fully overwrite it later.
|
||
|
|
* @see @ref Renderer::setClearColor(), @ref Renderer::setClearDepth(),
|
||
|
|
* @ref Renderer::setClearStencil(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* @fn_gl_keyword{Clear}
|
||
|
9 years ago
|
* @deprecated_gl Prefer to use @ref Framebuffer::clearColor() "*Framebuffer::clearColor()"
|
||
|
|
* / @ref clearDepth() / @ref clearDepthStencil() instead of
|
||
|
|
* @ref Renderer::setClearColor() / @ref Renderer::setClearDepth()
|
||
|
|
* / @ref Renderer::setClearStencil() and @ref clear() as it leads
|
||
|
|
* to less state changes.
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
AbstractFramebuffer& clear(FramebufferClearMask mask);
|
||
|
14 years ago
|
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
/**
|
||
|
|
* @brief Clear depth buffer to specified value
|
||
|
|
* @param depth Value to clear with
|
||
|
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
8 years ago
|
* @see @ref clear(), @fn_gl_keyword{ClearNamedFramebuffer}, eventually
|
||
|
|
* @fn_gl{BindFramebuffer}, then @fn_gl_keyword{ClearBuffer}
|
||
|
9 years ago
|
* @requires_gl30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL 2.1.
|
||
|
|
* @requires_gles30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL ES 2.0 or WebGL 1.0.
|
||
|
|
*/
|
||
|
|
AbstractFramebuffer& clearDepth(Float depth);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Clear stencil buffer to specified value
|
||
|
|
* @param stencil Value to clear with
|
||
|
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
8 years ago
|
* @see @ref clear(), @fn_gl_keyword{ClearNamedFramebuffer}, eventually
|
||
|
|
* @fn_gl{BindFramebuffer}, then @fn_gl_keyword{ClearBuffer}
|
||
|
9 years ago
|
* @requires_gl30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL 2.1.
|
||
|
|
* @requires_gles30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL ES 2.0 or WebGL 1.0.
|
||
|
|
*/
|
||
|
|
AbstractFramebuffer& clearStencil(Int stencil);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Clear depth and stencil buffer to specified value
|
||
|
|
* @param depth Depth value to clear with
|
||
|
|
* @param stencil Stencil value to clear with
|
||
|
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
8 years ago
|
* @see @ref clear(), @fn_gl_keyword{ClearNamedFramebuffer}, eventually
|
||
|
|
* @fn_gl{BindFramebuffer}, then @fn_gl_keyword{ClearBuffer}
|
||
|
9 years ago
|
* @requires_gl30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL 2.1.
|
||
|
|
* @requires_gles30 Direct framebuffer clearing is not available in
|
||
|
|
* OpenGL ES 2.0 or WebGL 1.0.
|
||
|
|
*/
|
||
|
|
AbstractFramebuffer& clearDepthStencil(Float depth, Int stencil);
|
||
|
|
#endif
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
|
* @brief Read block of pixels from framebuffer to image
|
||
|
11 years ago
|
* @param rectangle Framebuffer rectangle to read
|
||
|
12 years ago
|
* @param image Image where to put the data
|
||
|
14 years ago
|
*
|
||
|
12 years ago
|
* Image parameters like format and type of pixel data are taken from
|
||
|
11 years ago
|
* given image. The storage is not reallocated if it is large enough to
|
||
|
|
* contain the new data.
|
||
|
13 years ago
|
*
|
||
|
13 years ago
|
* If @extension{ARB,robustness} is available, the operation is
|
||
|
|
* protected from buffer overflow.
|
||
|
10 years ago
|
* @see @fn_gl{BindFramebuffer}, then @fn_gl{PixelStore} and
|
||
|
8 years ago
|
* @fn_gl_keyword{ReadPixels} or
|
||
|
|
* @fn_gl_extension_keyword{ReadnPixels,ARB,robustness}
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
void read(const Range2Di& rectangle, Image2D& image);
|
||
|
|
|
||
|
11 years ago
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp AbstractFramebuffer-read1
|
||
|
11 years ago
|
*/
|
||
|
|
Image2D read(const Range2Di& rectangle, Image2D&& image);
|
||
|
|
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
/**
|
||
|
|
* @brief Read block of pixels from framebuffer to buffer image
|
||
|
11 years ago
|
* @param rectangle Framebuffer rectangle to read
|
||
|
12 years ago
|
* @param image Buffer image where to put the data
|
||
|
|
* @param usage Buffer usage
|
||
|
14 years ago
|
*
|
||
|
8 years ago
|
* See @ref read(const Range2Di&, Image2D&) for more information. The
|
||
|
|
* storage is not reallocated if it is large enough to contain the new
|
||
|
|
* data, which means that @p usage might get ignored.
|
||
|
11 years ago
|
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES
|
||
|
|
* 2.0.
|
||
|
|
* @requires_webgl20 Pixel buffer objects are not available in WebGL
|
||
|
|
* 1.0.
|
||
|
12 years ago
|
* @todo Make it more flexible (usable with
|
||
|
|
* @extension{ARB,buffer_storage}, avoiding relocations...)
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
void read(const Range2Di& rectangle, BufferImage2D& image, BufferUsage usage);
|
||
|
|
|
||
|
11 years ago
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp AbstractFramebuffer-read2
|
||
|
11 years ago
|
*/
|
||
|
|
BufferImage2D read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 1D texture image
|
||
|
|
* @param rectangle Framebuffer rectangle to copy. Height must
|
||
|
|
* be `1`.
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param internalFormat Texture internal format
|
||
|
|
*
|
||
|
|
* On platforms that support it prefer to use @ref Texture1D::setStorage()
|
||
|
|
* and @ref copySubImage() instead, as it avoids unnecessary
|
||
|
|
* reallocations and has better performance characteristics. This call
|
||
|
|
* also has no equivalent in @extension{ARB,direct_state_access}, thus
|
||
|
|
* the texture needs to be bound to some texture unit before the
|
||
|
|
* operation.
|
||
|
|
* @see @ref Texture1D::maxSize(), @fn_gl{BindFramebuffer}, then
|
||
|
|
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexImage1D}
|
||
|
10 years ago
|
* @requires_gl 1D textures are not available in OpenGL ES or WebGL.
|
||
|
|
* @deprecated_gl Prefer to use @ref Texture1D::setStorage() and
|
||
|
|
* @ref copySubImage() instead.
|
||
|
|
*/
|
||
|
|
void copyImage(const Range2Di& rectangle, Texture1D& texture, Int level, TextureFormat internalFormat);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 2D texture image
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param internalFormat Texture internal format
|
||
|
|
*
|
||
|
|
* On platforms that support it prefer to use @ref Texture2D::setStorage()
|
||
|
|
* and @ref copySubImage() instead, as it avoids unnecessary
|
||
|
|
* reallocations and has better performance characteristics. This call
|
||
|
|
* also has no equivalent in @extension{ARB,direct_state_access}, thus
|
||
|
|
* the texture needs to be bound to some texture unit before the
|
||
|
|
* operation.
|
||
|
|
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
|
||
|
|
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexImage2D}
|
||
|
10 years ago
|
* @deprecated_gl Prefer to use @ref Texture2D::setStorage() and
|
||
|
|
* @ref copySubImage() instead.
|
||
|
|
*/
|
||
|
|
void copyImage(const Range2Di& rectangle, Texture2D& texture, Int level, TextureFormat internalFormat);
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to rectangle texture
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param internalFormat Texture internal format
|
||
|
|
*
|
||
|
|
* On platforms that support it prefer to use @ref RectangleTexture::setStorage()
|
||
|
|
* and @ref copySubImage() instead, as it avoids unnecessary
|
||
|
|
* reallocations and has better performance characteristics. This call
|
||
|
|
* also has no equivalent in @extension{ARB,direct_state_access}, thus
|
||
|
|
* the texture needs to be bound to some texture unit before the
|
||
|
|
* operation.
|
||
|
|
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
|
||
|
|
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexImage2D}
|
||
|
10 years ago
|
* @requires_gl31 Extension @extension{ARB,texture_rectangle}
|
||
|
|
* @requires_gl Rectangle textures are not available in OpenGL ES and
|
||
|
|
* WebGL.
|
||
|
|
* @deprecated_gl Prefer to use @ref RectangleTexture::setStorage() and
|
||
|
|
* @ref copySubImage() instead.
|
||
|
|
*/
|
||
|
|
void copyImage(const Range2Di& rectangle, RectangleTexture& texture, TextureFormat internalFormat);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to cube map texture image
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param coordinate Cube map coordinate
|
||
|
|
* @param internalFormat Texture internal format
|
||
|
|
*
|
||
|
|
* On platforms that support it prefer to use @ref CubeMapTexture::setStorage()
|
||
|
|
* and @ref copySubImage() instead, as it avoids unnecessary
|
||
|
|
* reallocations and has better performance characteristics. This call
|
||
|
|
* also has no equivalent in @extension{ARB,direct_state_access}, thus
|
||
|
|
* the texture needs to be bound to some texture unit before the
|
||
|
|
* operation.
|
||
|
|
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
|
||
|
|
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexImage2D}
|
||
|
10 years ago
|
* @deprecated_gl Prefer to use @ref CubeMapTexture::setStorage() and
|
||
|
|
* @ref copySubImage() instead.
|
||
|
|
*/
|
||
|
|
void copyImage(const Range2Di& rectangle, CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat);
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 1D texture array image
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param internalFormat Texture internal format
|
||
|
|
*
|
||
|
|
* On platforms that support it prefer to use @ref Texture2D::setStorage()
|
||
|
|
* and @ref copySubImage() instead, as it avoids unnecessary
|
||
|
|
* reallocations and has better performance characteristics. This call
|
||
|
|
* also has no equivalent in @extension{ARB,direct_state_access}, thus
|
||
|
|
* the texture needs to be bound to some texture unit before the
|
||
|
|
* operation.
|
||
|
|
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
|
||
|
|
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexImage2D}
|
||
|
10 years ago
|
* @requires_gl 1D array textures are not available in OpenGL ES or
|
||
|
|
* WebGL, only 2D ones.
|
||
|
|
* @deprecated_gl Prefer to use @ref Texture1DArray::setStorage() and
|
||
|
|
* @ref copySubImage() instead.
|
||
|
|
*/
|
||
|
|
void copyImage(const Range2Di& rectangle, Texture1DArray& texture, Int level, TextureFormat internalFormat);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 1D texture subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy. Height must
|
||
|
|
* be `1`.
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref Texture1D::setStorage(), @fn_gl{BindFramebuffer}, then
|
||
|
8 years ago
|
* @fn_gl2_keyword{CopyTextureSubImage1D,CopyTexSubImage1D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage1D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage1D}
|
||
|
10 years ago
|
* @requires_gl 1D textures are not available in OpenGL ES or WebGL.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, Texture1D& texture, Int level, Int offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 2D texture subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref Texture2D::setStorage(), @fn_gl{BindFramebuffer}, then
|
||
|
8 years ago
|
* @fn_gl2_keyword{CopyTextureSubImage2D,CopyTexSubImage2D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage2D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
|
* @fn_gl{CopyTexSubImage2D}
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, Texture2D& texture, Int level, const Vector2i& offset);
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to rectangle texture subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref RectangleTexture::setStorage(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* then @fn_gl2_keyword{CopyTextureSubImage2D,CopyTexSubImage2D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage2D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage2D}
|
||
|
10 years ago
|
* @requires_gl Rectangle textures are not available in OpenGL ES and
|
||
|
|
* WebGL.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, RectangleTexture& texture, const Vector2i& offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to cube map texture subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* Z coordinate of the offset is equivalent to number of texture face,
|
||
|
|
* i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y, +Z, -Z). If
|
||
|
|
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
|
||
|
|
* @extension{EXT,direct_state_access} desktop extension is available,
|
||
|
|
* the texture is bound before the operation (if not already).
|
||
|
|
* @see @ref CubeMapTexture::setStorage(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* then @fn_gl2_keyword{CopyTextureSubImage3D,CopyTexSubImage3D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage2D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage2D}
|
||
|
10 years ago
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, CubeMapTexture& texture, Int level, const Vector3i& offset);
|
||
|
|
|
||
|
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 3D texture subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref Texture3D::setStorage(), @fn_gl{BindFramebuffer}, then
|
||
|
8 years ago
|
* @fn_gl2_keyword{CopyTextureSubImage3D,CopyTexSubImage3D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage3D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage3D}
|
||
|
9 years ago
|
* @requires_gles30 Extension @extension{OES,texture_3D} in OpenGL
|
||
|
10 years ago
|
* ES 2.0.
|
||
|
|
* @requires_webgl20 Only 2D textures are available in WebGL 1.0.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, Texture3D& texture, Int level, const Vector3i& offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 1D texture array subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref Texture1DArray::setStorage(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* then @fn_gl2_keyword{CopyTextureSubImage2D,CopyTexSubImage2D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage2D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage2D}
|
||
|
10 years ago
|
* @requires_gl 1D array textures are not available in OpenGL ES or
|
||
|
|
* WebGL, only 2D ones.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, Texture1DArray& texture, Int level, const Vector2i& offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to 2D texture array subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
|
||
|
|
* nor @extension{EXT,direct_state_access} desktop extension is
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref Texture2DArray::setStorage(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* then @fn_gl2_keyword{CopyTextureSubImage3D,CopyTexSubImage3D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage3D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage3D}
|
||
|
10 years ago
|
* @requires_gl30 Extension @extension{EXT,texture_array}
|
||
|
|
* @requires_gles30 Array textures are not available in OpenGL ES 2.0.
|
||
|
|
* @requires_webgl20 Array textures are not available in WebGL 1.0.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, Texture2DArray& texture, Int level, const Vector3i& offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
/**
|
||
|
|
* @brief Copy block of pixels from framebuffer to cube map texture array subimage
|
||
|
|
* @param rectangle Framebuffer rectangle to copy
|
||
|
|
* @param texture Texture where to put the data
|
||
|
|
* @param level Texture mip level
|
||
|
|
* @param offset Offset inside the texture
|
||
|
|
*
|
||
|
|
* Z coordinate of the offset is equivalent to layer * 6 + number of
|
||
|
|
* texture face, i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y,
|
||
|
|
* +Z, -Z). If neither @extension{ARB,direct_state_access} (part of
|
||
|
|
* OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
|
||
|
|
* available, the texture is bound before the operation (if not
|
||
|
|
* already).
|
||
|
|
* @see @ref CubeMapTextureArray::setStorage(), @fn_gl{BindFramebuffer},
|
||
|
8 years ago
|
* then @fn_gl2_keyword{CopyTextureSubImage3D,CopyTexSubImage3D},
|
||
|
|
* @fn_gl_extension_keyword{CopyTextureSubImage3D,EXT,direct_state_access},
|
||
|
10 years ago
|
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
|
||
|
8 years ago
|
* @fn_gl_keyword{CopyTexSubImage3D}
|
||
|
10 years ago
|
* @requires_gl40 Extension @extension{ARB,texture_cube_map_array}
|
||
|
|
* @requires_gles30 Not defined in OpenGL ES 2.0.
|
||
|
9 years ago
|
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
* @extension{EXT,texture_cube_map_array}
|
||
|
10 years ago
|
* @requires_gles Cube map texture arrays are not available in WebGL.
|
||
|
|
*/
|
||
|
|
void copySubImage(const Range2Di& rectangle, CubeMapTextureArray& texture, Int level, const Vector3i& offset);
|
||
|
|
#endif
|
||
|
|
|
||
|
13 years ago
|
#ifdef DOXYGEN_GENERATING_OUTPUT
|
||
|
|
private:
|
||
|
|
#else
|
||
|
14 years ago
|
protected:
|
||
|
13 years ago
|
#endif
|
||
|
11 years ago
|
explicit AbstractFramebuffer(): _flags{ObjectFlag::DeleteOnDestruction} {}
|
||
|
|
explicit AbstractFramebuffer(GLuint id, const Range2Di& viewport, ObjectFlags flags) noexcept: _id{id}, _viewport{viewport}, _flags{flags} {}
|
||
|
|
|
||
|
13 years ago
|
~AbstractFramebuffer() = default;
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL createIfNotAlready();
|
||
|
12 years ago
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindInternal(FramebufferTarget target);
|
||
|
|
FramebufferTarget MAGNUM_GL_LOCAL bindInternal();
|
||
|
|
void MAGNUM_GL_LOCAL setViewportInternal();
|
||
|
14 years ago
|
|
||
|
14 years ago
|
GLuint _id;
|
||
|
13 years ago
|
Range2Di _viewport;
|
||
|
11 years ago
|
ObjectFlags _flags;
|
||
|
14 years ago
|
|
||
|
|
private:
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL blitImplementationDefault(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL blitImplementationDSA(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter);
|
||
|
12 years ago
|
#endif
|
||
|
11 years ago
|
#elif !defined(MAGNUM_TARGET_WEBGL)
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL blitImplementationANGLE(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter);
|
||
|
|
static void MAGNUM_GL_LOCAL blitImplementationNV(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter);
|
||
|
12 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindImplementationDefault(FramebufferTarget target);
|
||
|
|
FramebufferTarget MAGNUM_GL_LOCAL bindImplementationDefault();
|
||
|
11 years ago
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL bindImplementationSingle(FramebufferTarget);
|
||
|
|
FramebufferTarget MAGNUM_GL_LOCAL bindImplementationSingle();
|
||
|
11 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
GLenum MAGNUM_GL_LOCAL checkStatusImplementationDefault(FramebufferTarget target);
|
||
|
11 years ago
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
GLenum MAGNUM_GL_LOCAL checkStatusImplementationSingle(FramebufferTarget);
|
||
|
11 years ago
|
#endif
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
GLenum MAGNUM_GL_LOCAL checkStatusImplementationDSA(FramebufferTarget target);
|
||
|
|
GLenum MAGNUM_GL_LOCAL checkStatusImplementationDSAEXT(FramebufferTarget target);
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL clearImplementationDefault(GLenum buffer, GLint drawbuffer, const GLint* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDefault(GLenum buffer, GLint drawbuffer, const GLuint* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDefault(GLenum buffer, GLint drawbuffer, const GLfloat* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDefault(GLenum buffer, GLfloat depth, GLint stencil);
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL clearImplementationDSA(GLenum buffer, GLint drawbuffer, const GLint* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDSA(GLenum buffer, GLint drawbuffer, const GLuint* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDSA(GLenum buffer, GLint drawbuffer, const GLfloat* value);
|
||
|
|
void MAGNUM_GL_LOCAL clearImplementationDSA(GLenum buffer, GLfloat depth, GLint stencil);
|
||
|
9 years ago
|
#endif
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL drawBuffersImplementationDefault(GLsizei count, const GLenum* buffers);
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL drawBuffersImplementationDSA(GLsizei count, const GLenum* buffers);
|
||
|
|
void MAGNUM_GL_LOCAL drawBuffersImplementationDSAEXT(GLsizei count, const GLenum* buffers);
|
||
|
14 years ago
|
#endif
|
||
|
11 years ago
|
#else
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL drawBuffersImplementationEXT(GLsizei count, const GLenum* buffers);
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL drawBuffersImplementationNV(GLsizei count, const GLenum* buffers);
|
||
|
11 years ago
|
#endif
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL drawBufferImplementationDefault(GLenum buffer);
|
||
|
|
void MAGNUM_GL_LOCAL drawBufferImplementationDSA(GLenum buffer);
|
||
|
|
void MAGNUM_GL_LOCAL drawBufferImplementationDSAEXT(GLenum buffer);
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL readBufferImplementationDefault(GLenum buffer);
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL readBufferImplementationDSA(GLenum buffer);
|
||
|
|
void MAGNUM_GL_LOCAL readBufferImplementationDSAEXT(GLenum buffer);
|
||
|
14 years ago
|
#endif
|
||
|
13 years ago
|
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL readImplementationDefault(const Range2Di& rectangle, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL readImplementationRobustness(const Range2Di& rectangle, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL copySub1DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
|
||
|
|
static void MAGNUM_GL_LOCAL copySub1DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
|
||
|
|
static void MAGNUM_GL_LOCAL copySub1DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
|
||
|
10 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL copySub2DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL copySub2DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
|
||
|
|
static void MAGNUM_GL_LOCAL copySubCubeMapImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
|
||
|
|
static void MAGNUM_GL_LOCAL copySub2DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
|
||
|
10 years ago
|
#endif
|
||
|
|
|
||
|
|
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL copySub3DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
|
||
|
10 years ago
|
#endif
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
static void MAGNUM_GL_LOCAL copySub3DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
|
||
|
|
static void MAGNUM_GL_LOCAL copySub3DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
|
||
|
10 years ago
|
#endif
|
||
|
|
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImplementationNoOp(GLsizei, const GLenum*);
|
||
|
|
void MAGNUM_GL_LOCAL invalidateImplementationDefault(GLsizei count, const GLenum* attachments);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImplementationDSA(GLsizei count, const GLenum* attachments);
|
||
|
12 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImplementationNoOp(GLsizei, const GLenum*, const Range2Di&);
|
||
|
|
void MAGNUM_GL_LOCAL invalidateImplementationDefault(GLsizei count, const GLenum* attachments, const Range2Di& rectangle);
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
void MAGNUM_GL_LOCAL invalidateImplementationDSA(GLsizei count, const GLenum* attachments, const Range2Di& rectangle);
|
||
|
12 years ago
|
#endif
|
||
|
12 years ago
|
#endif
|
||
|
14 years ago
|
};
|
||
|
|
|
||
|
13 years ago
|
CORRADE_ENUMSET_OPERATORS(FramebufferClearMask)
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
13 years ago
|
CORRADE_ENUMSET_OPERATORS(FramebufferBlitMask)
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|