diff options
author | Wei-Ta Chen <weita@google.com> | 2011-08-29 15:44:23 -0700 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2011-08-29 15:44:23 -0700 |
commit | c73d5e20e80cf8b28017dff3b7672b8416a3a9f4 (patch) | |
tree | 25db205cb056927ee7868f410b58f9b68517885a /jni/feature_mos | |
parent | e6497af99de5581517eee8319ff894962027b47c (diff) | |
download | LegacyCamera-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/feature_mos')
-rwxr-xr-x | jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp | 14 |
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" |