Uniform handler for a shader program Cares about bind and releasing shaders and texture uniforms. Should only be used with the visual::useShader function.
More...
#include <UniformHandler.h>
|
| UniformHandler (QOpenGLFunctions &_gl, QOpenGLShaderProgram &_shader) |
|
| ~UniformHandler () |
| Destructor. Unbind all active texture units. More...
|
|
template<typename... ARGS> |
void | uniform (const char *_name, ARGS &&..._args) |
| Set uniform value. More...
|
|
void | texUniform (const char *_name, GLuint _texId, GLuint _target=GL_TEXTURE_2D) |
| Set uniform value for texture with id and optional target. More...
|
|
template<typename TEXTURE > |
void | texUniform (const char *_name, TEXTURE &_tex) |
| Set uniform value for texture object Texture object can be either QOpenGLTexture or Texture32F. More...
|
|
void | texRectUniform (const char *_name, GLuint _texId, QSize _size) |
|
Uniform handler for a shader program Cares about bind and releasing shaders and texture uniforms. Should only be used with the visual::useShader function.
omni::visual::UniformHandler::UniformHandler |
( |
QOpenGLFunctions & |
_gl, |
|
|
QOpenGLShaderProgram & |
_shader |
|
) |
| |
omni::visual::UniformHandler::~UniformHandler |
( |
| ) |
|
Destructor. Unbind all active texture units.
35 gl_.glActiveTexture(GL_TEXTURE0);
38 gl_.glBindTexture(_usedTextureTarget, 0);
void omni::visual::UniformHandler::texRectUniform |
( |
const char * |
_name, |
|
|
GLuint |
_texId, |
|
|
QSize |
_size |
|
) |
| |
45 QString(QString(_name) +
"_size").toUtf8().data(),
46 QVector2D(_size.width(),_size.height()));
void omni::visual::UniformHandler::texUniform |
( |
const char * |
_name, |
|
|
GLuint |
_texId, |
|
|
GLuint |
_target = GL_TEXTURE_2D |
|
) |
| |
Set uniform value for texture with id and optional target.
54 gl_.glBindTexture(_target, _texId);
template<typename TEXTURE >
void omni::visual::UniformHandler::texUniform |
( |
const char * |
_name, |
|
|
TEXTURE & |
_tex |
|
) |
| |
|
inline |
Set uniform value for texture object Texture object can be either QOpenGLTexture or Texture32F.
57 texUniform(_name, _tex.textureId(), _tex.target());
template<typename... ARGS>
void omni::visual::UniformHandler::uniform |
( |
const char * |
_name, |
|
|
ARGS &&... |
_args |
|
) |
| |
|
inline |
Set uniform value.
44 shader_.setUniformValue(_name, _args ...);
GLint omni::visual::UniformHandler::currentTextureUnit_ = 0 |
|
private |
QOpenGLFunctions& omni::visual::UniformHandler::gl_ |
|
private |
QOpenGLShaderProgram& omni::visual::UniformHandler::shader_ |
|
private |
std::set<GLuint> omni::visual::UniformHandler::usedTextureTargets_ |
|
private |
The documentation for this struct was generated from the following files: