| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 throw new RuntimeException("Could not locate '" + label + "' in program"); | 75 throw new RuntimeException("Could not locate '" + label + "' in program"); |
| 76 } | 76 } |
| 77 return location; | 77 return location; |
| 78 } | 78 } |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Enable and upload a vertex array for attribute |label|. The vertex data is
specified in | 81 * Enable and upload a vertex array for attribute |label|. The vertex data is
specified in |
| 82 * |buffer| with |dimension| number of components per vertex. | 82 * |buffer| with |dimension| number of components per vertex. |
| 83 */ | 83 */ |
| 84 public void setVertexAttribArray(String label, int dimension, FloatBuffer buff
er) { | 84 public void setVertexAttribArray(String label, int dimension, FloatBuffer buff
er) { |
| 85 setVertexAttribArray(label, dimension, 0, buffer); |
| 86 } |
| 87 |
| 88 /** |
| 89 * Enable and upload a vertex array for attribute |label|. The vertex data is
specified in |
| 90 * |buffer| with |dimension| number of components per vertex and specified |st
ride|. |
| 91 */ |
| 92 public void setVertexAttribArray(String label, int dimension, int stride, Floa
tBuffer buffer) { |
| 85 if (program == -1) { | 93 if (program == -1) { |
| 86 throw new RuntimeException("The program has been released"); | 94 throw new RuntimeException("The program has been released"); |
| 87 } | 95 } |
| 88 int location = getAttribLocation(label); | 96 int location = getAttribLocation(label); |
| 89 GLES20.glEnableVertexAttribArray(location); | 97 GLES20.glEnableVertexAttribArray(location); |
| 90 GLES20.glVertexAttribPointer(location, dimension, GLES20.GL_FLOAT, false, 0,
buffer); | 98 GLES20.glVertexAttribPointer(location, dimension, GLES20.GL_FLOAT, false, st
ride, buffer); |
| 91 GlUtil.checkNoGLES2Error("setVertexAttribArray"); | 99 GlUtil.checkNoGLES2Error("setVertexAttribArray"); |
| 92 } | 100 } |
| 93 | 101 |
| 94 public int getUniformLocation(String label) { | 102 public int getUniformLocation(String label) { |
| 95 if (program == -1) { | 103 if (program == -1) { |
| 96 throw new RuntimeException("The program has been released"); | 104 throw new RuntimeException("The program has been released"); |
| 97 } | 105 } |
| 98 int location = GLES20.glGetUniformLocation(program, label); | 106 int location = GLES20.glGetUniformLocation(program, label); |
| 99 if (location < 0) { | 107 if (location < 0) { |
| 100 throw new RuntimeException("Could not locate uniform '" + label + "' in pr
ogram"); | 108 throw new RuntimeException("Could not locate uniform '" + label + "' in pr
ogram"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 | 120 |
| 113 public void release() { | 121 public void release() { |
| 114 Logging.d(TAG, "Deleting shader."); | 122 Logging.d(TAG, "Deleting shader."); |
| 115 // Delete program, automatically detaching any shaders from it. | 123 // Delete program, automatically detaching any shaders from it. |
| 116 if (program != -1) { | 124 if (program != -1) { |
| 117 GLES20.glDeleteProgram(program); | 125 GLES20.glDeleteProgram(program); |
| 118 program = -1; | 126 program = -1; |
| 119 } | 127 } |
| 120 } | 128 } |
| 121 } | 129 } |
| OLD | NEW |