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.
681 lines
29 KiB
681 lines
29 KiB
|
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.
|
||
|
|
|
||
|
|
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
|
*/
|
||
|
|
|
||
|
|
#include "AbstractFramebuffer.h"
|
||
|
|
|
||
|
8 years ago
|
#include "Magnum/Image.h"
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
#include "Magnum/GL/BufferImage.h"
|
||
|
12 years ago
|
#endif
|
||
|
8 years ago
|
#include "Magnum/GL/Context.h"
|
||
|
|
#include "Magnum/GL/CubeMapTexture.h"
|
||
|
10 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
8 years ago
|
#include "Magnum/GL/CubeMapTextureArray.h"
|
||
|
10 years ago
|
#endif
|
||
|
8 years ago
|
#include "Magnum/GL/Extensions.h"
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
8 years ago
|
#include "Magnum/GL/RectangleTexture.h"
|
||
|
10 years ago
|
#endif
|
||
|
8 years ago
|
#include "Magnum/GL/Texture.h"
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
8 years ago
|
#include "Magnum/GL/TextureArray.h"
|
||
|
10 years ago
|
#endif
|
||
|
8 years ago
|
#include "Magnum/GL/Implementation/FramebufferState.h"
|
||
|
|
#include "Magnum/GL/Implementation/State.h"
|
||
|
14 years ago
|
|
||
|
14 years ago
|
namespace Magnum {
|
||
|
|
|
||
|
13 years ago
|
Vector2i AbstractFramebuffer::maxViewportSize() {
|
||
|
10 years ago
|
Vector2i& value = Context::current().state().framebuffer->maxViewportSize;
|
||
|
13 years ago
|
|
||
|
|
/* Get the value, if not already cached */
|
||
|
|
if(value == Vector2i())
|
||
|
|
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, value.data());
|
||
|
|
|
||
|
|
return value;
|
||
|
|
}
|
||
|
|
|
||
|
|
Int AbstractFramebuffer::maxDrawBuffers() {
|
||
|
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
10 years ago
|
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_buffers>() &&
|
||
|
|
!Context::current().isExtensionSupported<Extensions::GL::NV::draw_buffers>())
|
||
|
13 years ago
|
return 0;
|
||
|
11 years ago
|
#else
|
||
|
10 years ago
|
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::draw_buffers>())
|
||
|
11 years ago
|
return 0;
|
||
|
|
#endif
|
||
|
13 years ago
|
#endif
|
||
|
|
|
||
|
10 years ago
|
GLint& value = Context::current().state().framebuffer->maxDrawBuffers;
|
||
|
13 years ago
|
|
||
|
|
/* Get the value, if not already cached */
|
||
|
|
if(value == 0) {
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
glGetIntegerv(GL_MAX_DRAW_BUFFERS, &value);
|
||
|
|
#else
|
||
|
11 years ago
|
glGetIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &value);
|
||
|
13 years ago
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
return value;
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
Int AbstractFramebuffer::maxDualSourceDrawBuffers() {
|
||
|
10 years ago
|
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::blend_func_extended>())
|
||
|
13 years ago
|
return 0;
|
||
|
|
|
||
|
10 years ago
|
GLint& value = Context::current().state().framebuffer->maxDualSourceDrawBuffers;
|
||
|
13 years ago
|
|
||
|
|
/* Get the value, if not already cached */
|
||
|
|
if(value == 0)
|
||
|
|
glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &value);
|
||
|
|
|
||
|
|
return value;
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::createIfNotAlready() {
|
||
|
11 years ago
|
if(_flags & ObjectFlag::Created) return;
|
||
|
12 years ago
|
|
||
|
|
/* glGen*() does not create the object, just reserves the name. Some
|
||
|
|
commands (such as glObjectLabel()) operate with IDs directly and they
|
||
|
|
require the object to be created. Binding the framebuffer finally
|
||
|
|
creates it. Also all EXT DSA functions implicitly create it. */
|
||
|
|
bindInternal();
|
||
|
11 years ago
|
CORRADE_INTERNAL_ASSERT(_flags & ObjectFlag::Created);
|
||
|
12 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
void AbstractFramebuffer::bind() {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
setViewportInternal();
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
13 years ago
|
void AbstractFramebuffer::bindInternal(FramebufferTarget target) {
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
11 years ago
|
bindImplementationDefault(target);
|
||
|
10 years ago
|
#elif defined(MAGNUM_TARGET_WEBGL)
|
||
|
10 years ago
|
static_cast<void>(target);
|
||
|
10 years ago
|
bindImplementationSingle();
|
||
|
|
#else
|
||
|
|
(this->*Context::current().state().framebuffer->bindImplementation)(target);
|
||
|
11 years ago
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
|
void AbstractFramebuffer::bindImplementationSingle(FramebufferTarget) {
|
||
|
10 years ago
|
Implementation::FramebufferState& state = *Context::current().state().framebuffer;
|
||
|
11 years ago
|
CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding);
|
||
|
|
if(state.readBinding == _id) return;
|
||
|
|
|
||
|
|
state.readBinding = state.drawBinding = _id;
|
||
|
|
|
||
|
|
/* Binding the framebuffer finally creates it */
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
11 years ago
|
glBindFramebuffer(GL_FRAMEBUFFER, _id);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
inline
|
||
|
|
#endif
|
||
|
|
void AbstractFramebuffer::bindImplementationDefault(FramebufferTarget target) {
|
||
|
10 years ago
|
Implementation::FramebufferState& state = *Context::current().state().framebuffer;
|
||
|
14 years ago
|
|
||
|
13 years ago
|
if(target == FramebufferTarget::Read) {
|
||
|
12 years ago
|
if(state.readBinding == _id) return;
|
||
|
|
state.readBinding = _id;
|
||
|
13 years ago
|
} else if(target == FramebufferTarget::Draw) {
|
||
|
12 years ago
|
if(state.drawBinding == _id) return;
|
||
|
|
state.drawBinding = _id;
|
||
|
10 years ago
|
} else CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
|
||
|
14 years ago
|
|
||
|
12 years ago
|
/* Binding the framebuffer finally creates it */
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
13 years ago
|
glBindFramebuffer(GLenum(target), _id);
|
||
|
14 years ago
|
}
|
||
|
14 years ago
|
|
||
|
13 years ago
|
FramebufferTarget AbstractFramebuffer::bindInternal() {
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
11 years ago
|
return bindImplementationDefault();
|
||
|
10 years ago
|
#elif defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
return bindImplementationSingle();
|
||
|
|
#else
|
||
|
|
return (this->*Context::current().state().framebuffer->bindInternalImplementation)();
|
||
|
11 years ago
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
|
FramebufferTarget AbstractFramebuffer::bindImplementationSingle() {
|
||
|
10 years ago
|
Implementation::FramebufferState& state = *Context::current().state().framebuffer;
|
||
|
11 years ago
|
CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding);
|
||
|
|
|
||
|
|
/* Bind the framebuffer, if not already */
|
||
|
|
if(state.readBinding != _id) {
|
||
|
|
state.readBinding = state.drawBinding = _id;
|
||
|
|
|
||
|
|
/* Binding the framebuffer finally creates it */
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
11 years ago
|
glBindFramebuffer(GL_FRAMEBUFFER, _id);
|
||
|
|
}
|
||
|
|
|
||
|
9 years ago
|
/* On ES2 w/o separate read/draw bindings the return value is used as a
|
||
|
|
first parameter to glFramebufferRenderbuffer() etc. and so it needs to
|
||
|
|
be unconditionally GL_FRAMEBUFFER. That value is not part of the public
|
||
|
|
enum, though. */
|
||
|
|
return FramebufferTarget(GL_FRAMEBUFFER);
|
||
|
11 years ago
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
inline
|
||
|
|
#endif
|
||
|
|
FramebufferTarget AbstractFramebuffer::bindImplementationDefault() {
|
||
|
10 years ago
|
Implementation::FramebufferState& state = *Context::current().state().framebuffer;
|
||
|
14 years ago
|
|
||
|
|
/* Return target to which the framebuffer is already bound */
|
||
|
12 years ago
|
if(state.readBinding == _id)
|
||
|
13 years ago
|
return FramebufferTarget::Read;
|
||
|
12 years ago
|
if(state.drawBinding == _id)
|
||
|
13 years ago
|
return FramebufferTarget::Draw;
|
||
|
14 years ago
|
|
||
|
|
/* Or bind it, if not already */
|
||
|
12 years ago
|
state.readBinding = _id;
|
||
|
14 years ago
|
|
||
|
12 years ago
|
/* Binding the framebuffer finally creates it */
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
13 years ago
|
glBindFramebuffer(GLenum(FramebufferTarget::Read), _id);
|
||
|
|
return FramebufferTarget::Read;
|
||
|
14 years ago
|
}
|
||
|
14 years ago
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
12 years ago
|
void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
|
||
|
10 years ago
|
Context::current().state().framebuffer->blitImplementation(source, destination, sourceRectangle, destinationRectangle, mask, filter);
|
||
|
12 years ago
|
}
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
void AbstractFramebuffer::blitImplementationDefault(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
|
||
|
13 years ago
|
source.bindInternal(FramebufferTarget::Read);
|
||
|
|
destination.bindInternal(FramebufferTarget::Draw);
|
||
|
13 years ago
|
glBlitFramebuffer(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::blitImplementationDSA(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
|
||
|
|
glBlitNamedFramebuffer(source._id, destination._id, sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#elif !defined(MAGNUM_TARGET_WEBGL)
|
||
|
12 years ago
|
void AbstractFramebuffer::blitImplementationANGLE(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
|
||
|
|
source.bindInternal(FramebufferTarget::Read);
|
||
|
|
destination.bindInternal(FramebufferTarget::Draw);
|
||
|
12 years ago
|
glBlitFramebufferANGLE(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
|
||
|
12 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::blitImplementationNV(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
|
||
|
|
source.bindInternal(FramebufferTarget::Read);
|
||
|
|
destination.bindInternal(FramebufferTarget::Draw);
|
||
|
12 years ago
|
glBlitFramebufferNV(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
|
||
|
12 years ago
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
13 years ago
|
AbstractFramebuffer& AbstractFramebuffer::setViewport(const Range2Di& rectangle) {
|
||
|
11 years ago
|
CORRADE_INTERNAL_ASSERT(rectangle != Implementation::FramebufferState::DisengagedViewport);
|
||
|
14 years ago
|
_viewport = rectangle;
|
||
|
14 years ago
|
|
||
|
|
/* Update the viewport if the framebuffer is currently bound */
|
||
|
10 years ago
|
if(Context::current().state().framebuffer->drawBinding == _id)
|
||
|
14 years ago
|
setViewportInternal();
|
||
|
13 years ago
|
|
||
|
13 years ago
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::setViewportInternal() {
|
||
|
10 years ago
|
Implementation::FramebufferState& state = *Context::current().state().framebuffer;
|
||
|
14 years ago
|
|
||
|
11 years ago
|
CORRADE_INTERNAL_ASSERT(_viewport != Implementation::FramebufferState::DisengagedViewport);
|
||
|
12 years ago
|
CORRADE_INTERNAL_ASSERT(state.drawBinding == _id);
|
||
|
14 years ago
|
|
||
|
|
/* Already up-to-date, nothing to do */
|
||
|
12 years ago
|
if(state.viewport == _viewport)
|
||
|
14 years ago
|
return;
|
||
|
|
|
||
|
|
/* Update the state and viewport */
|
||
|
12 years ago
|
state.viewport = _viewport;
|
||
|
13 years ago
|
glViewport(_viewport.left(), _viewport.bottom(), _viewport.sizeX(), _viewport.sizeY());
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
AbstractFramebuffer& AbstractFramebuffer::clear(const FramebufferClearMask mask) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Draw);
|
||
|
13 years ago
|
glClear(GLbitfield(mask));
|
||
|
11 years ago
|
|
||
|
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
14 years ago
|
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
AbstractFramebuffer& AbstractFramebuffer::clearDepth(const Float depth) {
|
||
|
|
(this->*Context::current().state().framebuffer->clearFImplementation)(GL_DEPTH, 0, &depth);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
AbstractFramebuffer& AbstractFramebuffer::clearStencil(const Int stencil) {
|
||
|
|
(this->*Context::current().state().framebuffer->clearIImplementation)(GL_STENCIL, 0, &stencil);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
AbstractFramebuffer& AbstractFramebuffer::clearDepthStencil(const Float depth, const Int stencil) {
|
||
|
|
(this->*Context::current().state().framebuffer->clearFIImplementation)(GL_DEPTH_STENCIL, depth, stencil);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
void AbstractFramebuffer::read(const Range2Di& rectangle, Image2D& image) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Read);
|
||
|
11 years ago
|
|
||
|
|
/* Reallocate only if needed */
|
||
|
|
const std::size_t dataSize = Implementation::imageDataSizeFor(image, rectangle.size());
|
||
|
|
Containers::Array<char> data{image.release()};
|
||
|
|
if(data.size() < dataSize)
|
||
|
|
data = Containers::Array<char>{dataSize};
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
|
||
|
|
#endif
|
||
|
11 years ago
|
image.storage().applyPack();
|
||
|
10 years ago
|
(Context::current().state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), data.size(), data
|
||
|
11 years ago
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
|
+ Implementation::pixelStorageSkipOffsetFor(image, rectangle.size())
|
||
|
|
#endif
|
||
|
|
);
|
||
|
8 years ago
|
image = Image2D{image.storage(), image.format(), image.type(), rectangle.size(), std::move(data)};
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
Image2D AbstractFramebuffer::read(const Range2Di& rectangle, Image2D&& image) {
|
||
|
|
read(rectangle, image);
|
||
|
|
return std::move(image);
|
||
|
|
}
|
||
|
|
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
11 years ago
|
void AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D& image, BufferUsage usage) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Read);
|
||
|
11 years ago
|
|
||
|
|
/* Reallocate only if needed */
|
||
|
11 years ago
|
const std::size_t dataSize = Implementation::imageDataSizeFor(image, rectangle.size());
|
||
|
11 years ago
|
if(image.dataSize() < dataSize)
|
||
|
11 years ago
|
image.setData(image.storage(), image.format(), image.type(), rectangle.size(), {nullptr, dataSize}, usage);
|
||
|
11 years ago
|
else
|
||
|
|
image.setData(image.storage(), image.format(), image.type(), rectangle.size(), nullptr, usage);
|
||
|
14 years ago
|
|
||
|
12 years ago
|
image.buffer().bindInternal(Buffer::TargetHint::PixelPack);
|
||
|
11 years ago
|
image.storage().applyPack();
|
||
|
10 years ago
|
(Context::current().state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), dataSize, nullptr);
|
||
|
14 years ago
|
}
|
||
|
11 years ago
|
|
||
|
|
BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage) {
|
||
|
|
read(rectangle, image, usage);
|
||
|
|
return std::move(image);
|
||
|
|
}
|
||
|
14 years ago
|
#endif
|
||
|
|
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture1D& texture, const Int level, const TextureFormat internalFormat) {
|
||
|
|
CORRADE_ASSERT(rectangle.sizeY() == 1, "AbstractFramebuffer::copyImage(): height must be 1 for 1D textures", );
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexImage1D(GL_TEXTURE_1D, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), 0);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture2D& texture, const Int level, const TextureFormat internalFormat) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexImage2D(GL_TEXTURE_2D, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, RectangleTexture& texture, const TextureFormat internalFormat) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const TextureFormat internalFormat) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexImage2D(GLenum(coordinate), level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture1DArray& texture, const Int level, const TextureFormat internalFormat) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexImage2D(GL_TEXTURE_1D_ARRAY, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture1D& texture, const Int level, const Int offset) {
|
||
|
|
CORRADE_ASSERT(rectangle.sizeY() == 1, "AbstractFramebuffer::copyImage(): height must be 1 for 1D textures", );
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub1DImplementation(rectangle, texture, level, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture2D& texture, const Int level, const Vector2i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_2D, level, offset);
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, RectangleTexture& texture, const Vector2i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_RECTANGLE, 0, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, CubeMapTexture& texture, const Int level, const Vector3i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySubCubeMapImplementation(rectangle, texture, GL_TEXTURE_CUBE_MAP_POSITIVE_X + offset.z(), level, offset.xy());
|
||
|
|
}
|
||
|
|
|
||
|
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture3D& texture, const Int level, const Vector3i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture1DArray& texture, const Int level, const Vector2i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_1D_ARRAY, level, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture2DArray& texture, const Int level, const Vector3i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
|
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, CubeMapTextureArray& texture, const Int level, const Vector3i& offset) {
|
||
|
|
bindInternal(FramebufferTarget::Read);
|
||
|
|
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::invalidateImplementationNoOp(GLsizei, const GLenum* const) {}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::invalidateImplementationDefault(const GLsizei count, const GLenum* const attachments) {
|
||
|
14 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
glInvalidateFramebuffer(GLenum(bindInternal()), count, attachments);
|
||
|
9 years ago
|
#elif !defined(CORRADE_TARGET_EMSCRIPTEN)
|
||
|
12 years ago
|
glDiscardFramebufferEXT(GLenum(bindInternal()), count, attachments);
|
||
|
14 years ago
|
#else
|
||
|
14 years ago
|
static_cast<void>(count);
|
||
|
|
static_cast<void>(attachments);
|
||
|
10 years ago
|
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
|
||
|
14 years ago
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::invalidateImplementationDSA(const GLsizei count, const GLenum* const attachments) {
|
||
|
|
glInvalidateNamedFramebufferData(_id, count, attachments);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
12 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
12 years ago
|
void AbstractFramebuffer::invalidateImplementationNoOp(GLsizei, const GLenum*, const Range2Di&) {}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::invalidateImplementationDefault(const GLsizei count, const GLenum* const attachments, const Range2Di& rectangle) {
|
||
|
13 years ago
|
glInvalidateSubFramebuffer(GLenum(bindInternal()), count, attachments, rectangle.left(), rectangle.bottom(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
14 years ago
|
}
|
||
|
12 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::invalidateImplementationDSA(const GLsizei count, const GLenum* const attachments, const Range2Di& rectangle) {
|
||
|
|
glInvalidateNamedFramebufferSubData(_id, count, attachments, rectangle.left(), rectangle.bottom(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
#endif
|
||
|
12 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
13 years ago
|
GLenum AbstractFramebuffer::checkStatusImplementationDefault(const FramebufferTarget target) {
|
||
|
|
bindInternal(target);
|
||
|
|
return glCheckFramebufferStatus(GLenum(target));
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
#ifdef MAGNUM_TARGET_GLES2
|
||
|
|
GLenum AbstractFramebuffer::checkStatusImplementationSingle(FramebufferTarget) {
|
||
|
|
bindInternal(FramebufferTarget{});
|
||
|
|
return glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
12 years ago
|
GLenum AbstractFramebuffer::checkStatusImplementationDSA(const FramebufferTarget target) {
|
||
|
|
return glCheckNamedFramebufferStatus(_id, GLenum(target));
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
GLenum AbstractFramebuffer::checkStatusImplementationDSAEXT(const FramebufferTarget target) {
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
13 years ago
|
return glCheckNamedFramebufferStatusEXT(_id, GLenum(target));
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
9 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
void AbstractFramebuffer::clearImplementationDefault(const GLenum buffer, const GLint drawbuffer, const GLint* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearBufferiv(buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDefault(const GLenum buffer, const GLint drawbuffer, const GLuint* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearBufferuiv(buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDefault(const GLenum buffer, const GLint drawbuffer, const GLfloat* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearBufferfv(buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDefault(const GLenum buffer, const GLfloat depth, const GLint stencil) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearBufferfi(buffer, 0, depth, stencil);
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::clearImplementationDSA(const GLenum buffer, const GLint drawbuffer, const GLint* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearNamedFramebufferiv(_id, buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDSA(const GLenum buffer, const GLint drawbuffer, const GLuint* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearNamedFramebufferuiv(_id, buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDSA(const GLenum buffer, const GLint drawbuffer, const GLfloat* const value) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearNamedFramebufferfv(_id, buffer, drawbuffer, value);
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::clearImplementationDSA(const GLenum buffer, const GLfloat depth, const GLint stencil) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glClearNamedFramebufferfi(_id, buffer, 0, depth, stencil);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
14 years ago
|
void AbstractFramebuffer::drawBuffersImplementationDefault(GLsizei count, const GLenum* buffers) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Draw);
|
||
|
12 years ago
|
|
||
|
14 years ago
|
glDrawBuffers(count, buffers);
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
12 years ago
|
void AbstractFramebuffer::drawBuffersImplementationDSA(const GLsizei count, const GLenum* const buffers) {
|
||
|
|
glNamedFramebufferDrawBuffers(_id, count, buffers);
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::drawBuffersImplementationDSAEXT(GLsizei count, const GLenum* buffers) {
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
14 years ago
|
glFramebufferDrawBuffersEXT(_id, count, buffers);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
11 years ago
|
#else
|
||
|
|
void AbstractFramebuffer::drawBuffersImplementationEXT(GLsizei count, const GLenum* buffers) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
glDrawBuffersEXT(count, buffers);
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
11 years ago
|
void AbstractFramebuffer::drawBuffersImplementationNV(GLsizei count, const GLenum* buffers) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Draw);
|
||
|
11 years ago
|
glDrawBuffersNV(count, buffers);
|
||
|
14 years ago
|
}
|
||
|
11 years ago
|
#endif
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
11 years ago
|
void AbstractFramebuffer::drawBufferImplementationDefault(GLenum buffer) {
|
||
|
|
bindInternal(FramebufferTarget::Draw);
|
||
|
|
|
||
|
|
glDrawBuffer(buffer);
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::drawBufferImplementationDSA(const GLenum buffer) {
|
||
|
|
glNamedFramebufferDrawBuffer(_id, buffer);
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::drawBufferImplementationDSAEXT(GLenum buffer) {
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
14 years ago
|
glFramebufferDrawBufferEXT(_id, buffer);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
|
||
|
14 years ago
|
void AbstractFramebuffer::readBufferImplementationDefault(GLenum buffer) {
|
||
|
13 years ago
|
bindInternal(FramebufferTarget::Read);
|
||
|
12 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
14 years ago
|
glReadBuffer(buffer);
|
||
|
|
#else
|
||
|
9 years ago
|
glReadBufferNV(buffer);
|
||
|
14 years ago
|
#endif
|
||
|
|
}
|
||
|
11 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
12 years ago
|
void AbstractFramebuffer::readBufferImplementationDSA(const GLenum buffer) {
|
||
|
10 years ago
|
glNamedFramebufferReadBuffer(_id, buffer);
|
||
|
12 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
void AbstractFramebuffer::readBufferImplementationDSAEXT(GLenum buffer) {
|
||
|
11 years ago
|
_flags |= ObjectFlag::Created;
|
||
|
14 years ago
|
glFramebufferReadBufferEXT(_id, buffer);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
void AbstractFramebuffer::readImplementationDefault(const Range2Di& rectangle, const PixelFormat format, const PixelType type, const std::size_t, GLvoid* const data) {
|
||
|
11 years ago
|
glReadPixels(rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), GLenum(format), GLenum(type), data);
|
||
|
13 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_WEBGL
|
||
|
11 years ago
|
void AbstractFramebuffer::readImplementationRobustness(const Range2Di& rectangle, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) {
|
||
|
13 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
11 years ago
|
glReadnPixelsARB(rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), GLenum(format), GLenum(type), dataSize, data);
|
||
|
13 years ago
|
#else
|
||
|
9 years ago
|
glReadnPixelsEXT(rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), GLenum(format), GLenum(type), dataSize, data);
|
||
|
13 years ago
|
#endif
|
||
|
|
}
|
||
|
11 years ago
|
#endif
|
||
|
13 years ago
|
|
||
|
10 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySub1DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexSubImage1D(texture._target, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySub1DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
|
||
|
|
glCopyTextureSubImage1D(texture._id, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySub1DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
|
||
|
|
texture._flags |= ObjectFlag::Created;
|
||
|
|
glCopyTextureSubImage1DEXT(texture._id, texture._target, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySub2DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
|
||
|
|
texture.bindInternal();
|
||
|
|
glCopyTexSubImage2D(target, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySub2DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const GLenum, const Int level, const Vector2i& offset) {
|
||
|
|
glCopyTextureSubImage2D(texture._id, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySubCubeMapImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
|
||
|
|
glCopyTextureSubImage3D(texture._id, level, offset.x(), offset.y(), target - GL_TEXTURE_CUBE_MAP_POSITIVE_X, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySub2DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
|
||
|
|
texture._flags |= ObjectFlag::Created;
|
||
|
|
glCopyTextureSubImage2DEXT(texture._id, target, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
|
||
|
|
void AbstractFramebuffer::copySub3DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
|
||
|
|
texture.bindInternal();
|
||
|
|
#ifndef MAGNUM_TARGET_GLES2
|
||
|
|
glCopyTexSubImage3D
|
||
|
|
#else
|
||
|
|
glCopyTexSubImage3DOES
|
||
|
|
#endif
|
||
|
|
(texture._target, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
void AbstractFramebuffer::copySub3DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
|
||
|
|
glCopyTextureSubImage3D(texture._id, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
|
||
|
|
void AbstractFramebuffer::copySub3DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
|
||
|
|
texture._flags |= ObjectFlag::Created;
|
||
|
|
glCopyTextureSubImage3DEXT(texture._id, texture._target, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
14 years ago
|
}
|