當前位置: 首頁>>代碼示例>>Java>>正文


Java GLES20.GL_TEXTURE4屬性代碼示例

本文整理匯總了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);
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:53,代碼來源:JFAVoronoiFilter.java


注:本文中的android.opengl.GLES20.GL_TEXTURE4屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。