diff --git a/src/Magnum/Shaders/DistanceFieldVectorGL.h b/src/Magnum/Shaders/DistanceFieldVectorGL.h index 518a255a0..21d8e6d28 100644 --- a/src/Magnum/Shaders/DistanceFieldVectorGL.h +++ b/src/Magnum/Shaders/DistanceFieldVectorGL.h @@ -88,12 +88,15 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, because the shader doesn't need a separate projection and transformation matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D -buffer. To maximize use of the limited uniform buffer memory, materials are -supplied separately in a @ref DistanceFieldVectorMaterialUniform buffer and -then referenced via @relativeref{DistanceFieldVectorDrawUniform,materialId} -from a @ref DistanceFieldVectorDrawUniform; for optional texture transformation -a per-draw @ref TextureTransformationUniform can be supplied as well. A uniform -buffer setup equivalent to the above would look like this: +buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of +the limited uniform buffer memory, materials are supplied separately in a +@ref DistanceFieldVectorMaterialUniform buffer bound with +@ref bindMaterialBuffer() and then referenced via +@relativeref{DistanceFieldVectorDrawUniform,materialId} from a +@ref DistanceFieldVectorDrawUniform bound with @ref bindDrawBuffer(); for +optional texture transformation a per-draw @ref TextureTransformationUniform +buffer bound with @ref bindTextureTransformationBuffer() can be supplied as +well. A uniform buffer setup equivalent to the above would look like this: @snippet MagnumShaders-gl.cpp DistanceFieldVectorGL-ubo diff --git a/src/Magnum/Shaders/FlatGL.h b/src/Magnum/Shaders/FlatGL.h index 2d24c85a7..b13442300 100644 --- a/src/Magnum/Shaders/FlatGL.h +++ b/src/Magnum/Shaders/FlatGL.h @@ -170,12 +170,15 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, because the shader doesn't need a separate projection and transformation matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D -buffer. To maximize use of the limited uniform buffer memory, materials are -supplied separately in a @ref FlatMaterialUniform buffer and then referenced -via @relativeref{FlatDrawUniform,materialId} from a @ref FlatDrawUniform; for -optional texture transformation a per-draw @ref TextureTransformationUniform -can be supplied as well. A uniform buffer setup equivalent to the -@ref Shaders-FlatGL-colored "colored case at the top" would look like this: +buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of +the limited uniform buffer memory, materials are supplied separately in a +@ref FlatMaterialUniform buffer bound with @ref bindMaterialBuffer() and then +referenced via @relativeref{FlatDrawUniform,materialId} from a +@ref FlatDrawUniform bound with @ref bindDrawBuffer(); for optional texture +transformation a per-draw @ref TextureTransformationUniform buffer bound with +@ref bindTextureTransformationBuffer() can be supplied as well. A uniform +buffer setup equivalent to +the @ref Shaders-FlatGL-colored "colored case at the top" would look like this: @snippet MagnumShaders-gl.cpp FlatGL-ubo diff --git a/src/Magnum/Shaders/MeshVisualizerGL.h b/src/Magnum/Shaders/MeshVisualizerGL.h index a5529e92e..0c3a5f01e 100644 --- a/src/Magnum/Shaders/MeshVisualizerGL.h +++ b/src/Magnum/Shaders/MeshVisualizerGL.h @@ -177,6 +177,15 @@ texture offset (or offset and layer). in OpenGL ES 2.0. @requires_webgl20 Extension @webgl_extension{ANGLE,instanced_arrays} in WebGL 1.0. + +@section Shaders-MeshVisualizerGL2D-ubo Uniform buffers + +Unlike with @ref Shaders-MeshVisualizerGL2D-ubo "uniform buffers in the 3D variant", +because the shader doesn't need a separate projection and transformation +matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D +buffer bound with @ref bindTransformationProjectionBuffer(), and +a trimmed-down @ref MeshVisualizerDrawUniform2D is used instead of +@ref MeshVisualizerDrawUniform3D. The rest is the same. */ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisualizerGLBase { public: @@ -1192,11 +1201,16 @@ texture offset (or offset and layer). See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, the shader needs a separate -@ref ProjectionUniform3D and @ref TransformationUniform3D buffer. To maximize -use of the limited uniform buffer memory, materials are supplied separately in -a @ref MeshVisualizerMaterialUniform and then referenced via +@ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with +@ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively. +To maximize use of the limited uniform buffer memory, materials are supplied +separately in a @ref MeshVisualizerMaterialUniform buffer bound with +@ref bindMaterialBuffer() and then referenced via @relativeref{MeshVisualizerDrawUniform3D,materialId} from a -@ref MeshVisualizerDrawUniform3D. A uniform buffer setup equivalent to the +@ref MeshVisualizerDrawUniform3D buffer bound with @ref bindDrawBuffer(); for optional texture transformation a per-draw +@ref TextureTransformationUniform buffer bound with +@ref bindTextureTransformationBuffer() can be supplied as well. A uniform +buffer setup equivalent to the @ref Shaders-MeshVisualizerGL3D-wireframe "wireframe case at the top" would look like this --- note that @ref setViewportSize() is an immediate uniform here as well, as it's assumed to be set globally and rarely changed: diff --git a/src/Magnum/Shaders/PhongGL.h b/src/Magnum/Shaders/PhongGL.h index 23afc33c9..4435e4b81 100644 --- a/src/Magnum/Shaders/PhongGL.h +++ b/src/Magnum/Shaders/PhongGL.h @@ -259,14 +259,19 @@ well to ensure lighting works: See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, the shader needs a separate -@ref ProjectionUniform3D and @ref TransformationUniform3D buffer, lights are -supplied via a @ref PhongLightUniform. To maximize use of the limited uniform -buffer memory, materials are supplied separately in a @ref PhongMaterialUniform -buffer and then referenced via @relativeref{PhongDrawUniform,materialId} from a -@ref PhongDrawUniform; for optional texture transformation a per-draw -@ref TextureTransformationUniform can be supplied as well. A uniform buffer -setup equivalent to the @ref Shaders-PhongGL-colored "colored case at the top", -with one default light, would look like this: +@ref ProjectionUniform3D and @ref TransformationUniform3D buffer bound with +@ref bindProjectionBuffer() and @ref bindTransformationBuffer(), respectively, +lights are supplied via a @ref PhongLightUniform buffer bound with +@ref bindLightBuffer(). To maximize use of the limited uniform buffer memory, +materials are supplied separately in a @ref PhongMaterialUniform buffer +bound with @ref bindMaterialBuffer() and then referenced via +@relativeref{PhongDrawUniform,materialId} from a @ref PhongDrawUniform bound +with @ref bindDrawBuffer(); for optional texture transformation a per-draw +@ref TextureTransformationUniform buffer bound with +@ref bindTextureTransformationBuffer() can be supplied as well. A uniform +buffer setup equivalent to the +@ref Shaders-PhongGL-colored "colored case at the top", with one default light, +would look like this: @snippet MagnumShaders-gl.cpp PhongGL-ubo diff --git a/src/Magnum/Shaders/VectorGL.h b/src/Magnum/Shaders/VectorGL.h index a41caafbe..976d41e0e 100644 --- a/src/Magnum/Shaders/VectorGL.h +++ b/src/Magnum/Shaders/VectorGL.h @@ -86,12 +86,14 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, because the shader doesn't need a separate projection and transformation matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D -buffer. To maximize use of the limited uniform buffer memory, materials are -supplied separately in a @ref VectorMaterialUniform buffer and then referenced -via @relativeref{VectorDrawUniform,materialId} from a @ref VectorDrawUniform; -for optional texture transformation a per-draw -@ref TextureTransformationUniform can be supplied as well. A uniform buffer -setup equivalent to the above would look like this: +buffer bound with @ref bindTransformationProjectionBuffer(). To maximize use of +the limited uniform buffer memory, materials are supplied separately in a +@ref VectorMaterialUniform buffer bound with @ref bindMaterialBuffer() and then +referenced via @relativeref{VectorDrawUniform,materialId} from a +@ref VectorDrawUniform buffer bound with @ref bindDrawBuffer(); for optional +texture transformation a per-draw @ref TextureTransformationUniform buffer +bound with @ref bindTextureTransformationBuffer() can be supplied as well. A +uniform buffer setup equivalent to the above would look like this: @snippet MagnumShaders-gl.cpp VectorGL-ubo diff --git a/src/Magnum/Shaders/VertexColorGL.h b/src/Magnum/Shaders/VertexColorGL.h index 7c063edeb..78a26ee25 100644 --- a/src/Magnum/Shaders/VertexColorGL.h +++ b/src/Magnum/Shaders/VertexColorGL.h @@ -87,9 +87,9 @@ See @ref shaders-usage-ubo for a high-level overview that applies to all shaders. In this particular case, because the shader doesn't need a separate projection and transformation matrix, a combined one is supplied via a @ref TransformationProjectionUniform2D / @ref TransformationProjectionUniform3D -buffer. This is also the only buffer supplied, as there are no other draw -parameters. A uniform buffer setup equivalent to the above would look like -this: +buffer bound with @ref bindTransformationProjectionBuffer(). This is also the +only buffer supplied, as there are no other draw parameters. A uniform buffer +setup equivalent to the above would look like this: @snippet MagnumShaders-gl.cpp VectorGL-ubo