From 779808e2f7e0c34cbc0c9ecf41fce506fa9bddb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 29 Sep 2012 00:42:58 +0200 Subject: [PATCH] Added setUniform() for doubles. I knew it did exist, but the manuals said otherwise. --- src/AbstractShaderProgram.h | 121 ++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 56aff7675..c695f1d66 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -447,6 +447,44 @@ class MAGNUM_EXPORT AbstractShaderProgram { glUniform4uiv(location, 1, value.data()); } + #ifndef MAGNUM_TARGET_GLES + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, GLdouble value) { + glUniform1d(location, value); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<1, 2, GLdouble>& value) { + glUniform2dv(location, 1, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<1, 3, GLdouble>& value) { + glUniform3dv(location, 1, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<1, 4, GLdouble>& value) { + glUniform4dv(location, 1, value.data()); + } + #endif + /** @copydoc setUniform(GLint, GLfloat) */ inline void setUniform(GLint location, const Math::RectangularMatrix<2, 2, GLfloat>& value) { glUniformMatrix2fv(location, 1, GL_FALSE, value.data()); @@ -510,6 +548,89 @@ class MAGNUM_EXPORT AbstractShaderProgram { glUniformMatrix4x3fv(location, 1, GL_FALSE, value.data()); } + #ifndef MAGNUM_TARGET_GLES + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<2, 2, GLdouble>& value) { + glUniformMatrix2dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<3, 3, GLdouble>& value) { + glUniformMatrix3dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<4, 4, GLdouble>& value) { + glUniformMatrix4dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<2, 3, GLdouble>& value) { + glUniformMatrix2x3dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<3, 2, GLdouble>& value) { + glUniformMatrix3x2dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<2, 4, GLdouble>& value) { + glUniformMatrix2x4dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<4, 2, GLdouble>& value) { + glUniformMatrix4x2dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<3, 4, GLdouble>& value) { + glUniformMatrix3x4dv(location, 1, GL_FALSE, value.data()); + } + + /** + * @copydoc setUniform(GLint, GLfloat) + * @requires_gl40 Extension @extension{ARB,gpu_shader_fp64} + * @requires_gl Only floats are available in OpenGL ES. + */ + inline void setUniform(GLint location, const Math::RectangularMatrix<4, 3, GLdouble>& value) { + glUniformMatrix4x3dv(location, 1, GL_FALSE, value.data()); + } + #endif + private: enum State { Initialized,