add setUniformLocationWithMatrix2fv, setUniformLocationWithMatrix3fv mothed in GLProgram class.

This commit is contained in:
bmanGH 2013-10-28 00:58:57 +08:00
parent b7dcf51af3
commit 693257fffe
2 changed files with 24 additions and 0 deletions

View File

@ -512,6 +512,24 @@ void GLProgram::setUniformLocationWith4fv(GLint location, GLfloat* floats, unsig
} }
} }
void GLProgram::setUniformLocationWithMatrix2fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices) {
bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*4*numberOfMatrices);
if( updated )
{
glUniformMatrix2fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray);
}
}
void GLProgram::setUniformLocationWithMatrix3fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices) {
bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*9*numberOfMatrices);
if( updated )
{
glUniformMatrix3fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray);
}
}
void GLProgram::setUniformLocationWithMatrix4fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices) void GLProgram::setUniformLocationWithMatrix4fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices)
{ {

View File

@ -198,6 +198,12 @@ public:
/** calls glUniform4fv only if the values are different than the previous call for this same shader program. */ /** calls glUniform4fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith4fv(GLint location, GLfloat* floats, unsigned int numberOfArrays); void setUniformLocationWith4fv(GLint location, GLfloat* floats, unsigned int numberOfArrays);
/** calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix2fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices);
/** calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix3fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices);
/** calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. */ /** calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix4fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices); void setUniformLocationWithMatrix4fv(GLint location, GLfloat* matrixArray, unsigned int numberOfMatrices);