本文整理匯總了Java中android.opengl.GLES20.GL_TEXTURE4屬性的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.GL_TEXTURE4屬性的具體用法?Java GLES20.GL_TEXTURE4怎麽用?Java GLES20.GL_TEXTURE4使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.opengl.GLES20
的用法示例。
在下文中一共展示了GLES20.GL_TEXTURE4屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDraw
@Override
public void onDraw(int cameraTexId, int canvasWidth, int canvasHeight) {
// TODO move?
if (bufA == null || bufA.getWidth() != canvasWidth || bufB.getHeight() != canvasHeight) {
// Create new textures for buffering
bufA = new RenderBuffer(canvasWidth, canvasHeight, GLES20.GL_TEXTURE4);
bufB = new RenderBuffer(canvasWidth, canvasHeight, GLES20.GL_TEXTURE5);
bufC = new RenderBuffer(canvasWidth, canvasHeight, GLES20.GL_TEXTURE6);
}
// Render to buf a
setupShaderInputs(programA,
new int[]{canvasWidth, canvasHeight},
new int[]{cameraTexId, bufA.getTexId()},
new int[][]{new int[]{canvasWidth, canvasHeight}, new int[]{canvasWidth, canvasHeight}});
bufA.bind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
bufA.unbind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
// Render to buf b
setupShaderInputs(programB,
new int[]{canvasWidth, canvasHeight},
new int[]{bufB.getTexId(), bufA.getTexId()},
new int[][]{new int[]{canvasWidth, canvasHeight}, new int[]{canvasWidth, canvasHeight}});
bufB.bind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
bufB.unbind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
// Render to buf c
setupShaderInputs(programC,
new int[]{canvasWidth, canvasHeight},
new int[]{bufC.getTexId(), bufB.getTexId()},
new int[][]{new int[]{canvasWidth, canvasHeight}, new int[]{canvasWidth, canvasHeight}});
bufC.bind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
bufC.unbind();
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
// Render to screen
setupShaderInputs(programImg,
new int[]{canvasWidth, canvasHeight},
new int[]{bufC.getTexId(), bufA.getTexId()},
new int[][]{new int[]{canvasWidth, canvasHeight}, new int[]{canvasWidth, canvasHeight}});
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}