summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Program.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-07-27 19:53:33 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-07-27 19:53:33 -0700
commit85d8daa889db113b51c5d98929245e80f7277388 (patch)
treec20b40f4ea72fc2010fb6edf9cc1e1c5d76f2714 /libs/hwui/Program.cpp
parent8b67752c82a26e21fe0977cb5e201acf2e22824d (diff)
parentac670c0433d19397d4e36ced2110475b6f54fe26 (diff)
downloadframeworks_base-85d8daa889db113b51c5d98929245e80f7277388.zip
frameworks_base-85d8daa889db113b51c5d98929245e80f7277388.tar.gz
frameworks_base-85d8daa889db113b51c5d98929245e80f7277388.tar.bz2
Merge "Generate shaders to cover all possible cases."
Diffstat (limited to 'libs/hwui/Program.cpp')
-rw-r--r--libs/hwui/Program.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 6e60808..86fc154 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -27,7 +27,6 @@ namespace uirenderer {
#define SHADER_SOURCE(name, source) const char* name = #source
-#include "shaders/drawColor.vert"
#include "shaders/drawColor.frag"
#include "shaders/drawTexture.vert"
@@ -127,7 +126,7 @@ GLuint Program::buildShader(const char* source, GLenum type) {
///////////////////////////////////////////////////////////////////////////////
DrawColorProgram::DrawColorProgram():
- Program(gDrawColorVertexShader, gDrawColorFragmentShader) {
+ Program(gDrawTextureVertexShader, gDrawColorFragmentShader) {
getAttribsAndUniforms();
}
@@ -138,6 +137,7 @@ DrawColorProgram::DrawColorProgram(const char* vertex, const char* fragment):
void DrawColorProgram::getAttribsAndUniforms() {
position = addAttrib("position");
+ texCoords = addAttrib("texCoords");
color = addUniform("color");
transform = addUniform("transform");
}
@@ -154,11 +154,13 @@ void DrawColorProgram::set(const mat4& projectionMatrix, const mat4& modelViewMa
void DrawColorProgram::use() {
Program::use();
glEnableVertexAttribArray(position);
+ glEnableVertexAttribArray(texCoords);
}
void DrawColorProgram::remove() {
Program::remove();
glDisableVertexAttribArray(position);
+ glDisableVertexAttribArray(texCoords);
}
///////////////////////////////////////////////////////////////////////////////
@@ -167,26 +169,21 @@ void DrawColorProgram::remove() {
DrawTextureProgram::DrawTextureProgram():
DrawColorProgram(gDrawTextureVertexShader, gDrawTextureFragmentShader) {
- texCoords = addAttrib("texCoords");
sampler = addUniform("sampler");
}
DrawTextureProgram::DrawTextureProgram(const char* vertex, const char* fragment):
DrawColorProgram(vertex, fragment) {
- texCoords = addAttrib("texCoords");
sampler = addUniform("sampler");
}
void DrawTextureProgram::use() {
DrawColorProgram::use();
- glActiveTexture(GL_TEXTURE0);
glUniform1i(sampler, 0);
- glEnableVertexAttribArray(texCoords);
}
void DrawTextureProgram::remove() {
DrawColorProgram::remove();
- glDisableVertexAttribArray(texCoords);
}
///////////////////////////////////////////////////////////////////////////////