Browse Source

GL: refresh AbstractShaderProgram and Attribute docs slightly.

With an emphasis on how these are only meant to be used by custom shader
implementations and not end users. More needs to be done.
pull/525/head
Vladimír Vondruš 5 years ago
parent
commit
9a57227945
  1. 10
      src/Magnum/GL/AbstractShaderProgram.h
  2. 27
      src/Magnum/GL/Attribute.h

10
src/Magnum/GL/AbstractShaderProgram.h

@ -48,6 +48,16 @@ namespace Implementation { struct ShaderProgramState; }
/** /**
@brief Base for shader program implementations @brief Base for shader program implementations
Wraps an OpenGL shader program object. Meant to be only used through
subclasses, either via builtin shaders in the @ref Shaders namespace or by
creating a custom shader implementation.
@m_class{m-note m-success}
@par
A simple custom shader implementation is shown in the
@ref examples-texturedquad "Textured Quad example".
@section GL-AbstractShaderProgram-subclassing Subclassing workflow @section GL-AbstractShaderProgram-subclassing Subclassing workflow
This class is designed to be used via subclassing. Subclasses define these This class is designed to be used via subclassing. Subclasses define these

27
src/Magnum/GL/Attribute.h

@ -45,17 +45,22 @@ namespace Magnum { namespace GL {
namespace Implementation { template<class> struct Attribute; } namespace Implementation { template<class> struct Attribute; }
/** /**
@brief Base class for vertex attribute location and type @brief Base class for specifying shader attributes
For use in @ref AbstractShaderProgram subclasses. The @p location template Meant to be used mainly through a @cpp typedef @ce in
parameter is vertex attribute location, a number between @cpp 0 @ce and @ref AbstractShaderProgram subclasses. Shader consumers are then supposed to
@ref AbstractShaderProgram::maxVertexAttributes(). To ensure compatibility, you use the @cpp typedef @ce, or in case of builtin attributes the definitions from
should always have a vertex attribute with location @cpp 0 @ce. @ref Shaders::GenericGL and other classes from the @ref Shaders namespace.
The @p T template parameter is the type which is used for shader attribute, The @p location template parameter is a vertex attribute location, a number
e.g. @ref Magnum::Vector4i "Vector4i" for @glsl ivec4 @ce. @ref DataType is between @cpp 0 @ce and @ref AbstractShaderProgram::maxVertexAttributes(). To
type of passed data when adding vertex buffers to mesh. By default it is the ensure compatibility, you should always have a vertex attribute with location
same as type used in shader (e.g. @ref DataType::Int for @cpp 0 @ce.
The @p T template parameter is the type that matches the shader attribute
declaration, e.g. @ref Magnum::Vector4i "Vector4i" for @glsl ivec4 @ce.
@ref DataType is the type of passed data when adding vertex buffers to mesh.
By default it is the same as type used in shader (e.g. @ref DataType::Int for
@ref Magnum::Vector4i "Vector4i"). It's also possible to pass integer data to @ref Magnum::Vector4i "Vector4i"). It's also possible to pass integer data to
floating-point shader inputs. In this case you may want to normalize the values floating-point shader inputs. In this case you may want to normalize the values
(e.g. color components from @cpp 0 @ce -- @cpp 255 @ce to @cpp 0.0f @ce -- (e.g. color components from @cpp 0 @ce -- @cpp 255 @ce to @cpp 0.0f @ce --

Loading…
Cancel
Save