|
AvogadroLibs 1.103.0
|
The ShaderProgram uses one or more Shader objects. More...
#include <avogadro/rendering/shaderprogram.h>
Public Types | |
| enum | NormalizeOption { Normalize , NoNormalize } |
Public Member Functions | |
| bool | attachShader (const Shader &shader) |
| bool | detachShader (const Shader &shader) |
| bool | link () |
| bool | bind () |
| void | release () |
| std::string | error () const |
| bool | enableAttributeArray (const std::string &name) |
| bool | disableAttributeArray (const std::string &name) |
| bool | useAttributeArray (const std::string &name, int offset, size_t stride, Avogadro::Type elementType, int elementTupleSize, NormalizeOption normalize) |
| template<class ContainerT> | |
| bool | setAttributeArray (const std::string &name, const ContainerT &array, int tupleSize, NormalizeOption normalize) |
| bool | setTextureSampler (const std::string &samplerName, const Texture2D &texture) |
| bool | setUniformValue (const std::string &name, int i) |
| bool | setUniformValue (const std::string &name, float f) |
| bool | setUniformValue (const std::string &name, const Eigen::Matrix3f &matrix) |
| bool | setUniformValue (const std::string &name, const Eigen::Matrix4f &matrix) |
| bool | setUniformValue (const std::string &name, const Vector3f &v) |
| bool | setUniformValue (const std::string &name, const Vector2i &v) |
| bool | setUniformValue (const std::string &name, const Vector3ub &v) |
Protected Member Functions | |
| bool | setAttributeArrayInternal (const std::string &name, void *buffer, Avogadro::Type type, int tupleSize, NormalizeOption normalize) |
Protected Attributes | |
| Index | m_handle |
| Index | m_vertexShader |
| Index | m_fragmentShader |
| bool | m_linked |
| std::string | m_error |
| std::map< std::string, int > | m_attributes |
| std::map< const Texture2D *, int > | m_textureUnitBindings |
| std::vector< bool > | m_boundTextureUnits |
This class creates a Vertex or Fragment shader, that can be attached to a ShaderProgram in order to render geometry etc.
| enum NormalizeOption |
Options for attribute normalization.
| bool attachShader | ( | const Shader & | shader | ) |
Attach the supplied shader to this program.
| bool detachShader | ( | const Shader & | shader | ) |
Detach the supplied shader from this program.
| bool link | ( | ) |
Attempt to link the shader program.
| bool bind | ( | ) |
Bind the program in order to use it. If the program has not been linked then link() will be called.
| void release | ( | ) |
Releases the shader program from the current context.
| std::string error | ( | ) | const |
Get the error message (empty if none) for the shader program.
| bool enableAttributeArray | ( | const std::string & | name | ) |
Enable the named attribute array. Return false if the attribute array is not contained in the linked shader program.
| bool disableAttributeArray | ( | const std::string & | name | ) |
Disable the named attribute array. Return false if the attribute array is not contained in the linked shader program.
| bool useAttributeArray | ( | const std::string & | name, |
| int | offset, | ||
| size_t | stride, | ||
| Avogadro::Type | elementType, | ||
| int | elementTupleSize, | ||
| NormalizeOption | normalize ) |
Use the named attribute array with the bound BufferObject.
| name | of the attribute (as seen in the shader program). |
| offset | into the bound BufferObject. |
| stride | The stride of the element access (i.e. the size of each element in the currently bound BufferObject). 0 may be used to indicate tightly packed data. |
| elementType | Tag identifying the memory representation of the element. |
| elementTupleSize | The number of elements per vertex (e.g. a 3D position attribute would be 3). |
| normalize | Indicates the range used by the attribute data. See NormalizeOption for more information. |
| bool setAttributeArray | ( | const std::string & | name, |
| const ContainerT & | array, | ||
| int | tupleSize, | ||
| NormalizeOption | normalize ) |
Upload the supplied array of tightly packed values to the named attribute. BufferObject attributes should be preferred and this may be removed in future.
| name | Attribute name |
| array | Container of data. See note. |
| tupleSize | The number of elements per vertex, e.g. a 3D coordinate array will have a tuple size of 3. |
| normalize | Indicates the range used by the attribute data. See NormalizeOption for more information. |
| bool setTextureSampler | ( | const std::string & | samplerName, |
| const Texture2D & | texture ) |
Set the sampler samplerName to use the specified texture.
| bool setUniformValue | ( | const std::string & | name, |
| int | i ) |
Set the name uniform value to int i.
| bool setUniformValue | ( | const std::string & | name, |
| float | f ) |
Set the name uniform value to float f.
| bool setUniformValue | ( | const std::string & | name, |
| const Eigen::Matrix3f & | matrix ) |
Set the name uniform value to matrix.
| bool setUniformValue | ( | const std::string & | name, |
| const Vector3f & | v ) |
Set the name uniform value to the supplied value.
| bool setUniformValue | ( | const std::string & | name, |
| const Vector2i & | v ) |
Set the name uniform value to the supplied value.
| bool setUniformValue | ( | const std::string & | name, |
| const Vector3ub & | v ) |
Set the name uniform value to the supplied value.