From 0b9db91c3dc8007b47c8fd4fb9dd85be97201a88 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 9 Jul 2010 18:53:25 -0700 Subject: Remove math from the vertex shader. Change-Id: I02847a60a8734bf8b3d29ec12e76297795095e38 --- libs/hwui/Program.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libs/hwui/Program.cpp') diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp index 819e7368aad3..98d254cc9fdb 100644 --- a/libs/hwui/Program.cpp +++ b/libs/hwui/Program.cpp @@ -127,17 +127,17 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment): void DrawColorProgram::getAttribsAndUniforms() { position = addAttrib("position"); color = addUniform("color"); - projection = addUniform("projection"); - modelView = addUniform("modelView"); transform = addUniform("transform"); } -void DrawColorProgram::use(const GLfloat* projectionMatrix, const GLfloat* modelViewMatrix, - const GLfloat* transformMatrix) { +void DrawColorProgram::use(const float* projectionMatrix, const mat4& modelViewMatrix, + const mat4& transformMatrix) { + mat4 t(projectionMatrix); + t.multiply(transformMatrix); + t.multiply(modelViewMatrix); + Program::use(); - glUniformMatrix4fv(projection, 1, GL_FALSE, projectionMatrix); - glUniformMatrix4fv(modelView, 1, GL_FALSE, modelViewMatrix); - glUniformMatrix4fv(transform, 1, GL_FALSE, transformMatrix); + glUniformMatrix4fv(transform, 1, GL_FALSE, &t.data[0]); } /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-59-g8ed1b