Browse Source

MeshTools: update fullScreenTriangle() docs.

pull/324/head
Vladimír Vondruš 7 years ago
parent
commit
5bf09f0cea
  1. 28
      src/Magnum/MeshTools/FullScreenTriangle.h

28
src/Magnum/MeshTools/FullScreenTriangle.h

@ -40,28 +40,28 @@
namespace Magnum { namespace MeshTools {
/**
@brief Create full screen triangle mesh
@brief Full screen triangle mesh
Returns pre-configured mesh along with vertex buffer which can be used for
full-screen post-processing effects. The mesh is single triangle covering whole
screen area (@f$ (-1, -1) - (1, 1) @f$ on both dimensions) and provides only
vertex positions, as other attributes (such as texture coordinates) can be
computed from them. The vertex positions are, in order:
Returns a pre-configured mesh along with vertex buffer which can be used for
full-screen post-processing effects. The mesh is a single triangle covering
whole screen area (@f$ (-1, -1) - (1, 1) @f$ in both dimensions) and provides
only vertex positions, as other attributes (such as texture coordinates) can be
calculated from them. The vertex positions are, in order:
@f[
\begin{pmatrix} -1 \\ 1 \end{pmatrix},
\begin{pmatrix} -1 \\ -3 \end{pmatrix},
\begin{pmatrix} 3 \\ 1 \end{pmatrix}
@f]
Based on @p version parameter, on OpenGL 2.1 and OpenGL ES 2.0 the vertex
positions are passed explicitly as attribute @cpp 0 @ce, contained in the
buffer. On OpenGL 3.0+ and OpenGL ES 3.0+ the mesh is attribute-less and the
vertex positions can be computed using @glsl gl_VertexID @ce builtin shader
variable, thus @cpp nullptr @ce is returned instead of vertex buffer.
Based on the @p version parameter, on OpenGL 2.1, OpenGL ES 2.0 and WebGL 1 the
vertex positions are passed explicitly as attribute @cpp 0 @ce, contained in
a vertex buffer owned by the mesh. On OpenGL 3.0+, OpenGL ES 3.0+ and WebGL 2
the mesh is attribute-less and the vertex positions can be calculated using the
@glsl gl_VertexID @ce builtin shader variable.
Computing positions in vertex shader in a portable way might be done like this.
For OpenGL 2.1 and OpenGL ES 2.0 you then need to bind the location of `position`
attribute to @cpp 0 @ce.
Calculating positions in the shader in a portable way can be done like this.
For OpenGL 2.1 and OpenGL ES 2.0 you then need to bind location of the
`position` attribute to @cpp 0 @ce.
@code{.glsl}
#if (!defined(GL_ES) && __VERSION__ >= 130) || (defined(GL_ES) && __VERSION__ >= 300)

Loading…
Cancel
Save