Previously the API didn't encourage the user to set up and activate
shader before drawing the meshes, leading to unintuitive behavior:
// Can I just call draw() or do I have to fully understand the
// meaning of the universe before?
mesh.draw();
Now the draw() needs the shader passed explicitly as parameter, which
should hint that the shader must be set up somehow:
// Right, so this needs just a shader and that's all. Expecting this
// I fortunately *did* configure all the uniforms before this call.
mesh.draw(shader);
It is also possible to pass the shader as rvalue, in case the drawing is
just a one-off thing and is already fully configured.
mesh.draw(MyShader{});
As usual, the original API is kept, is marked as deprecated and will be
removed in some future release.
We are allowing implicit conversions only if they are harmless and this
is *not* harmless, as it might fire an assertion. The user should use
operator*() or operator->() instead, which will make these conversions
stand out more in the code. Also reduced code duplication.
Also added (currently disabled) ES implementation (provided by
EXT_separate_shader_objects). Unfortunately it's not possible to reduce
the function count, because ARB_separate_shader_objects and
EXT_direct_state_access are completely independent. Also double uniforms
are supported since GL 4.0 and SSO are since 4.1, so we can't omit
old glUniform*() calls for doubles either.
It now defaults to magnum/ subdirectory of dir where main Magnum library
was found. It was *annoying* to change /usr/local/lib/magnum to
/usr/lib/magnum _every time_.
It now returns new index array instead of operating on already existing
one and also custom vector size is removed. The internal implementation
is now much simpler and cleaner. The old way (but still without custom
vector size) is now alias to the new implementation, is marked as
deprecated and will be removed in future release.
Renamed the parameters and reworded the documentation so it doesn't talk
about vertices, but rather about generic floating-point vector data.
Added combineIndexArrays() function, which can combine any number of
indexarrays (i.e. number specified at runtime). The function originated
in ColladaImporter plugin and is moved here to make it useful elsewhere.
It is now used as base for combineIndexedArrays(), which is further
simplified without unnecessary functor-like implementation. Also
improved documentation.
The combineIndexedArrays() function now takes std::pair instead of
std::tuple, the previous version is alias to the new one, is marked as
deprecated and will be removed in some future release.
Spotted by MSVC compiler (which does range check on everything). This
was probably harmless, as the out-of-range memory wasn't accessed
afterwards (the for cycle would end right after that because vi == 3),
but it was firing the assertion so it's better to have it fixed.
The previous way was half-working at best, as it handled array textures
improperly. Now there is overload for each texture type. The old way
with attachTexture*D() is marked as deprecated and will be removed in
future release.
Each texture has slightly different usage requirements and having
everything under one generic class is not worth the additional runtime
checks and whatnot. The current way with Texture::Target enum
(hopefully not too widely used) is now deprecated and will be removed in
some future release. However general Texture1D/2D/3D usage is not
changed in any way.
Both don't have GL_{MAJOR,MINOR}_VERSION enums so we must decide whether
the version is older than OpenGL 3.0 / ES 3.0 either using
MAGNUM_TARGET_GLES2 preprocessor definition or checking for invalid enum
error and then we have to parse version string to ensure that the
version is not too old. On ES2 the version check wasn't present at all
(only optimistic hope), this makes it more hardened.