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

Loading…
Cancel
Save