Ensure we set the right attrib for correct shader
When using oesProgram, we still specify the yuvProgram for setting shader attributes. This should be changed to the correct shader program. BUG= R=glaznev@webrtc.org Review URL: https://webrtc-codereview.appspot.com/45379004 Cr-Commit-Position: refs/heads/master@{#8533} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8533 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
385a7ceb1f
commit
21ad37528e
@ -406,6 +406,8 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
|
||||
long now = System.nanoTime();
|
||||
|
||||
int currentProgram = 0;
|
||||
|
||||
I420Frame frameFromQueue;
|
||||
synchronized (frameToRenderQueue) {
|
||||
frameFromQueue = frameToRenderQueue.peek();
|
||||
@ -416,6 +418,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
if (rendererType == RendererType.RENDERER_YUV) {
|
||||
// YUV textures rendering.
|
||||
GLES20.glUseProgram(yuvProgram);
|
||||
currentProgram = yuvProgram;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + i);
|
||||
@ -430,9 +433,16 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
frameFromQueue.yuvPlanes[i]);
|
||||
}
|
||||
}
|
||||
GLES20.glUniform1i(
|
||||
GLES20.glGetUniformLocation(yuvProgram, "y_tex"), 0);
|
||||
GLES20.glUniform1i(
|
||||
GLES20.glGetUniformLocation(yuvProgram, "u_tex"), 1);
|
||||
GLES20.glUniform1i(
|
||||
GLES20.glGetUniformLocation(yuvProgram, "v_tex"), 2);
|
||||
} else {
|
||||
// External texture rendering.
|
||||
GLES20.glUseProgram(oesProgram);
|
||||
currentProgram = oesProgram;
|
||||
|
||||
if (frameFromQueue != null) {
|
||||
oesTexture = frameFromQueue.textureId;
|
||||
@ -452,13 +462,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
if (rendererType == RendererType.RENDERER_YUV) {
|
||||
GLES20.glUniform1i(GLES20.glGetUniformLocation(yuvProgram, "y_tex"), 0);
|
||||
GLES20.glUniform1i(GLES20.glGetUniformLocation(yuvProgram, "u_tex"), 1);
|
||||
GLES20.glUniform1i(GLES20.glGetUniformLocation(yuvProgram, "v_tex"), 2);
|
||||
}
|
||||
|
||||
int posLocation = GLES20.glGetAttribLocation(yuvProgram, "in_pos");
|
||||
int posLocation = GLES20.glGetAttribLocation(currentProgram, "in_pos");
|
||||
if (posLocation == -1) {
|
||||
throw new RuntimeException("Could not get attrib location for in_pos");
|
||||
}
|
||||
@ -466,7 +470,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
GLES20.glVertexAttribPointer(
|
||||
posLocation, 2, GLES20.GL_FLOAT, false, 0, textureVertices);
|
||||
|
||||
int texLocation = GLES20.glGetAttribLocation(yuvProgram, "in_tc");
|
||||
int texLocation = GLES20.glGetAttribLocation(currentProgram, "in_tc");
|
||||
if (texLocation == -1) {
|
||||
throw new RuntimeException("Could not get attrib location for in_tc");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user