Enable uploading vertex array with non-zero stride in Android shader.

Bug: chromium:761472
Change-Id: I1c9ec8d0c2d26f00213750c8433acf61a234bd0a
Reviewed-on: https://webrtc-review.googlesource.com/5601
Commit-Queue: Brandon Young <bpyoung@google.com>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20125}
This commit is contained in:
Brandon Young
2017-10-03 10:56:32 -07:00
committed by Commit Bot
parent d8071b81da
commit 0ef90d1f13

View File

@ -82,12 +82,20 @@ public class GlShader {
* |buffer| with |dimension| number of components per vertex.
*/
public void setVertexAttribArray(String label, int dimension, FloatBuffer buffer) {
setVertexAttribArray(label, dimension, 0 /* stride */, buffer);
}
/**
* Enable and upload a vertex array for attribute |label|. The vertex data is specified in
* |buffer| with |dimension| number of components per vertex and specified |stride|.
*/
public void setVertexAttribArray(String label, int dimension, int stride, FloatBuffer buffer) {
if (program == -1) {
throw new RuntimeException("The program has been released");
}
int location = getAttribLocation(label);
GLES20.glEnableVertexAttribArray(location);
GLES20.glVertexAttribPointer(location, dimension, GLES20.GL_FLOAT, false, 0, buffer);
GLES20.glVertexAttribPointer(location, dimension, GLES20.GL_FLOAT, false, stride, buffer);
GlUtil.checkNoGLES2Error("setVertexAttribArray");
}