summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-08-29 15:44:23 -0700
committerWei-Ta Chen <weita@google.com>2011-08-29 15:44:23 -0700
commitc73d5e20e80cf8b28017dff3b7672b8416a3a9f4 (patch)
tree25db205cb056927ee7868f410b58f9b68517885a /jni
parente6497af99de5581517eee8319ff894962027b47c (diff)
downloadLegacyCamera-c73d5e20e80cf8b28017dff3b7672b8416a3a9f4.zip
LegacyCamera-c73d5e20e80cf8b28017dff3b7672b8416a3a9f4.tar.gz
LegacyCamera-c73d5e20e80cf8b28017dff3b7672b8416a3a9f4.tar.bz2
Update the transform matrix from SurfaceTexture.
Bug: 5211070 Fix the issue that the transform matrix from SurfaceTexture is not set into the shader. Also, the texture coordinates are corrected to fix the upside down issue. Change-Id: Ia97f590a572aff64c65b6fb94672752e1634405b
Diffstat (limited to 'jni')
-rwxr-xr-xjni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
index c547d4d..5b6292b 100755
--- a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
+++ b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp
@@ -9,13 +9,13 @@
const GLfloat g_vVertices[] = {
-1.f, -1.f, 0.0f, 1.0f, // Position 0
- 0.0f, 1.0f, // TexCoord 0
+ 0.0f, 0.0f, // TexCoord 0
1.f, -1.f, 0.0f, 1.0f, // Position 1
- 1.0f, 1.0f, // TexCoord 1
+ 1.0f, 0.0f, // TexCoord 1
-1.f, 1.f, 0.0f, 1.0f, // Position 2
- 0.0f, 0.0f, // TexCoord 2
+ 0.0f, 1.0f, // TexCoord 2
1.f, 1.f, 0.0f, 1.0f, // Position 3
- 1.0f, 0.0f // TexCoord 3
+ 1.0f, 1.0f // TexCoord 3
};
GLushort g_iIndices2[] = { 0, 1, 2, 3 };
@@ -125,6 +125,7 @@ bool SurfaceTextureRenderer::DrawTexture(GLfloat *affine)
if (!checkGlError("glBindTexture")) break;
glUniformMatrix4fv(mScalingtransLoc, 1, GL_FALSE, mScalingMatrix);
+ glUniformMatrix4fv(muSTMatrixHandle, 1, GL_FALSE, mSTMatrix);
// Load the vertex position
glVertexAttribPointer(maPositionHandle, 4, GL_FLOAT,
@@ -151,12 +152,10 @@ const char* SurfaceTextureRenderer::VertexShaderSource() const
"uniform mat4 u_scalingtrans; \n"
"attribute vec4 aPosition;\n"
"attribute vec4 aTextureCoord;\n"
- "varying vec2 vTextureCoord;\n"
"varying vec2 vTextureNormCoord;\n"
"void main() {\n"
" gl_Position = u_scalingtrans * aPosition;\n"
- " vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n"
- " vTextureNormCoord = aTextureCoord.xy;\n"
+ " vTextureNormCoord = (uSTMatrix * aTextureCoord).xy;\n"
"}\n";
return gVertexShader;
@@ -167,7 +166,6 @@ const char* SurfaceTextureRenderer::FragmentShaderSource() const
static const char gFragmentShader[] =
"#extension GL_OES_EGL_image_external : require\n"
"precision mediump float;\n"
- "varying vec2 vTextureCoord;\n"
"varying vec2 vTextureNormCoord;\n"
"uniform samplerExternalOES sTexture;\n"
"void main() {\n"