* Normalization of e.g. color components passed as unsigned byte to
float values is possible.
* BGRA vector component ordering is possible.
* Proper type checking, allowing only GLSL-equivalent types to be used
as attributes.
* Reverted back to typedef'ing shader attributes, as type conversion
can now be specified in constructor.
* #version directive doesn't belong to shader sources, since it is
specified in Shader constructor.
* It's not needed to call use() before setUniform() anymore.
* Instead of "binding attributes" the user now "adds vertex buffer". It
corresponds better with what OpenGL itself does.
* Vertex buffers now must be managed by the user.
* Shader attributes are now static const members instead of typedefs to
allow more convenient add*VertexBuffer*() calls.
Also explicitly calling use() on default (non-DSA) setUniform()
implementation. Because of that, it is now possible to conveniently call
use() at the end, instead of at the beginning of uniform setting chain,
for example:
// before
shader->use();
shader->setTransformation(transformation)
->setProjection(projection)
->setColor(color);
// now
shader->setTransformation(transformation)
->setProjection(projection)
->setColor(color)
->use();
Note that you still have to explicitly call use(), because if DSA is
available, no use() is called explicitly on any setUniform(). If DSA is
not available, use() is called on first setUniform() and subsequent
calls have no negative performance impacts.
* Grouping lengthy documentation into "Feature overview" page.
* Link only to example index, where all the disclaimers are.
* Also minor documentation updates.
Vector4 doesn't set W component to one by default anymore, this is now
handled by Point*D itself. This finally allows creating of 2D primitives
and 2D position vectors without messing explicitly with Z = 1.
All classes which should use Point instead of Vector were updated to use
Point instead.
Now the #version string is added from Shader class itself, making it
possible to do workarounds for older versions more conveniently. As a
consequence, #version must not be part of shader source anymore.
Magnum.h now doesn't include anything except OpenGL headers, thus
changes in Math library don't trigger recompilation of everything, but
only of things really depending on it.
Math constants moved to separate file for similar reasons, de-inlined
some functions to remove the need for some #includes.
It only caused another maintenance burden and was confusing to users.
Now when scene graph is in SceneGraph namespace there is no need for
another grouping. Namespaces are (and should be) sufficient.
This reverts commit 79945ab6fc.
Conflicts:
src/BufferedImage.h
src/BufferedTexture.h
src/Framebuffer.h
src/Query.h
src/SceneGraph/Scene.h
Desktop OpenGL and OpenGL ES 2 support can be switched using CMake
TARGET_GLES option. All functionality not supported in ES is marked in
documentation.
If targetting OpenGL ES, GLES2/gl2.h is included instead of GLEW.
Mesh class now uses VAOs only in desktop OpenGL, in ES the buffers are
bound on each draw call.
According to OpenGL specification the sampler uniform takes only texture
layer and not any particular texture. In OpenGL 4.2 it is possible to
explicitly specify desired texture layer in the uniform, so I suppose
it's desired to have shader with fixed texture layers and on the other
hand be able to bind texture to any layer, not only one -- the exact
opposite of how it was in Magnum before.
The shader should now specify in its public API which texture is on
which layer and explicitly set the layer uniforms upon construction. All
setUniform() functions taking textures as argument were thus removed, as
they confuse things a lot.
The textures now have bind() function which takes layer as argument, so
it's now sufficient to only bind the texture before drawing the mesh
without messing with sampler uniform.
While namespaces act for hierarchy, modules are something like "tags" -
usable when you want to check related classes of e.g. CubeMapTexture.
Not sure how to name module for Math and Physics namespaces and
Contexts/Trade, though.
Preferred workflow is to specify attribute location explicitly in the
shader. The functions remains here as some old Intel systems don't
support the required extension ARB_explicit_attrib_location (and it's
not in GL 3.0 either). Also updated and fixed the documentation.
Function bindAttribute() was renamed to bindAttributeLocation() to be
consistent with bindFragmentDataLocation().
PhongShader now uses explicit attribute location.
Fixed a few typos in extension names, fixed BPTC texture compression
typos. Removed redundant EXT_framebuffer_object from functions as the
Framebuffer class itself has it.
For classes which already have pure virtual functions instantiation is
not allowed, but for other there needs to be at least one pure virtual
method: the destructor.
Pure virtual functions actually can have implementations, but they must
be called explicitly. Destructors are called explicitly, so for them it
works.
The class is now created always on the stack, so the user doesn't have
to delete it explicitly. It's now possible to write less verbose
shader code, instead of three lines before:
Shader* s = Shader::fromFile(Shader::Fragment, "Shader.frag");
attachShader(s);
// ...
delete s;
It's now only one:
attachShader(Shader::fromFile(Shader::Fragment, "Shader.frag"));
The requirements are cross-referenced to dedicated page, similarly to
TODO and bug lists.
Also updated / improved documentation for some texture / image formats.