It's now possible to do the reading operation in one statement.
Previously it was needed to have mutable variable:
Image2D image{ColorFormat::RGBA, ColorType::UnsignedByte};
framebuffer.read(framebuffer.viewport(), image);
Currently:
const Image2D image = framebuffer.read(framebuffer.viewport(),
{ColorFormat::RGBA, ColorType::UnsignedByte});
To make this possible, the two-parameter Image and BufferImage
constructors are now made implicit.
Less typing and less name duplication, but hides the actual load error
from the user. The error is printed on stdout anyway and the user
doesn't care anyway in 90% cases.
Not sure why I chose to have offset and size in these two function, but
that's probably because I never used them in real code. The original
overloads taking pair of Vector2i are now marked as deprecated and will
be removed in future release.
Direct access to list of children is now provided through
Object::children(), list of features is provided in
AbstractObject::features(). In most cases the range-based-for is good
enough, the previousSibling()/nextSibling() and
previousFeature()/nextFeature() functions are for the cases where user
needs more flexibility.
Because everything that was previously done using firstChild() etc. can
be now done also with children().first() etc., there would be more than
one way to do the same thing. Thus the old functions are now marked as
deprecated and will be removed in some future release.
It's not needed to manually specify whole component dependency tree,
also each MAGNUM_*_LIBRARIES and MAGNUM_*_INCLUDE_DIRS variable now
lists all external and inter-project dependencies.
For example, if the user requires DebugTools component, it automatically
searches also for all the following components:
MeshTools
Primitives
SceneGraph
Shaders
Shapes
And MAGNUM_DEBUGTOOLS_LIBRARIES contains the following extensive list of
libraries:
MagnumDebugTools
MagnumMeshTools
MagnumPrimitives
MagnumSceneGraph
MagnumShaders
MagnumShapes
Magnum
CorradePluginManager
CorradeUtility
libGL
Using std::numeric_limits for the Double variants looks like an overkill
to me, but there apparently isn't any other way, except for crafting the
value manually using the exact binary representation (and hoping it will
be portable) or producing the value as result of division by zero or
something like that (and then working around the warnings and also
hoping it will be portable).
Constants::piHalf() is not longer to write than doing the division
manually and it has significantly smaller mental overhead. Also I chose
piHalf() instead of halfPi() to make it more discoverable through
autocompletion.
Float a = Constants::pi()*0.5f;
Float a = Constants::piHalf();
Float b = Constants::pi()/(2*countOfSomething);
Float b = Constants::piHalf()/countOfSomething;
Originally enabled just on OSX, apparently something similar is needed
also in Mesa. If the version is not user-specified, core GL 3.2 is
created on OSX, core 3.0 elsewhere. If that fails, the application falls
back to creating compatibility 2.1 context.
Hopefully I didn't break anything. The only difference on OSX is that
the application doesn't fall back anymore if the version is
user-specified.
This function was added to ARB_instanced_arrays spec very late and thus
some implementations don't provide it (one case being AMD drivers on
Linux). If that function is not available, the non-DSA VAO specification
is used instead.
ARB_DSA is now preferred in single-bind cases, as it is easier to use
than passing pointers to ARB_multi_bind. ARB_multi_bind was preferred
for single-bind previously simply because EXT_DSA was not in core.
Because there is a lot to say about feature selection for each function,
I took this as a opportunity to remove redundant documentation blocks,
just refer to Texture documentation from everywhere and add extension
requirements and deprecation where needed, so it's clear for each class
what needs what.
ARB_DSA also took the opportunity to finally remove all target enum
values from function calls and because of that the CubeMapTexture has to
handle a bunch of special cases. In order:
- CubeMapTexture::imageSize() now doesn't take face parameter and
returns one value for all faces. I'm thus now also assuming that the
user is sane and called either setStorage() or setImage() with the
same size for all faces. In non-ARB_DSA path I'm thus querying only
size of +X face and returning it as size for all faces. The old
imageSize(Coordinate, Int) overload is still present, but ignores
the first parameter and calls imageSize(Int). It is marked as
deprecated and will be removed in some future release.
- CubeMapTexture::image() now needs to call glTextureSubImage() in
ARB_DSA path to make it possible to extract single face. Other code
paths (EXT_DSA, Robustness and "default") remain the same.
- CubeMapTexture::setSubImage() calls glTextureSubImage3D() in
ARB_DSA, because it is not possible to specify face index in
glTextureSubImage2D(). Other code paths (EXT_DSA and "default")
remain the same.
Implementation of these special cases is extracted into CubeMapTexture
class to avoid pollution of AbstractTexture with incompatible nonsense.
I ran into a weird problem with Corrade module path not being found when
using just CMAKE_INSTALL_PREFIX for Emscripten build. Amazingly enough,
this wasn't problem at all with all other crosscompilation builds. CMake
hates me, I think.
I think it's better to leave the choice on the user -- whether to do
nothing (which might be slower), invalidate whole framebuffer (which
might lose data) or do scissor + clear and thus emulate the
sub-framebuffer invalidation somehow.
Also, for some weird reason I made off-by-one error in
eb32fb1c40, so the documentation for
Framebuffer::invalidate() appeared in documentation block for
Framebuffer::attachRenderbuffer(). Should be fixed now.
The comment was right, but the code was apparently copy-pasted. Sadly no
unit test covered this, because nearly every desktop impl has
ARB_texture_storage and on ES2 (which is the only that doesn't have
texture storage) it's not possible to query image size, heh.
ARB_direct_state_access doesn't have equivalent for glTexImage*D(),
which indicates that these calls should not be used anymore. Also
removed EXT_direct_state_access code path and kept just the plain
glBindTexture() + glTexImage*D(), as I assume that all implementations
which have EXT_DSA have also ARB_texture_storage, thus this alternative
would have no use.