Пример #1
0
void HudShader::useProgram() {
	Shader::useProgram();
	
	if (_projectionMatrixDirty || _modelMatrixDirty) {
		glm::mat4 mvpMatrix = _projectionMatrix * _modelMatrix;
		GL(UniformMatrix4fv(_mvpMatrixLoc, 1, GL_FALSE, glm::value_ptr(mvpMatrix)));
		_projectionMatrixDirty = false;
		_modelMatrixDirty = false;
	}

	if (_colorDirty) {
		GL(Uniform4fv(_colorLoc, 1, glm::value_ptr(_color)));
		_colorDirty = false;
	}
}
Пример #2
0
void GrGpuGLShaders::flushColorMatrix() {
    const ProgramDesc& desc = fCurrentProgram.getDesc();
    int matrixUni = fProgramData->fUniLocations.fColorMatrixUni;
    int vecUni = fProgramData->fUniLocations.fColorMatrixVecUni;
    if (GrGLProgram::kUnusedUniform != matrixUni
     && GrGLProgram::kUnusedUniform != vecUni) {
        const float* m = this->getDrawState().getColorMatrix();
        GrGLfloat mt[]  = {
            m[0], m[5], m[10], m[15],
            m[1], m[6], m[11], m[16],
            m[2], m[7], m[12], m[17],
            m[3], m[8], m[13], m[18],
        };
        static float scale = 1.0f / 255.0f;
        GrGLfloat vec[] = {
            m[4] * scale, m[9] * scale, m[14] * scale, m[19] * scale,
        };
        GL_CALL(UniformMatrix4fv(matrixUni, 1, false, mt));
        GL_CALL(Uniform4fv(vecUni, 1, vec));
    }
}
Пример #3
0
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
	CONTEXT_EXEC(UniformMatrix4fv(location, count, transpose, value));
}