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


Java GLES20.glDepthMask方法代碼示例

本文整理匯總了Java中android.opengl.GLES20.glDepthMask方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glDepthMask方法的具體用法?Java GLES20.glDepthMask怎麽用?Java GLES20.glDepthMask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glDepthMask方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
private void draw(float[] matrix, FloatBuffer vertexBuffer, FloatBuffer uvBuffer, ShortBuffer drawListBuffer, short[] indices) {
    texture.bindTexture(0);
    GLES20.glEnable(GLES20.GL_BLEND_COLOR);
    GLES20.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glDepthMask(false);
    int mPositionHandle = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "vPosition");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    GLES20.glVertexAttribPointer(mPositionHandle, 3,
            GLES20.GL_FLOAT, false,
            0, vertexBuffer);
    int mTexCoordLoc = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "a_texCoord");
    GLES20.glEnableVertexAttribArray(mTexCoordLoc);
    GLES20.glVertexAttribPointer(mTexCoordLoc, 2, GLES20.GL_FLOAT,
            false,
            0, uvBuffer);
    int mtrxhandle = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "uMVPMatrix");
    GLES20.glUniformMatrix4fv(mtrxhandle, 1, false, matrix, 0);
    int mSamplerLoc = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "s_texture");
    GLES20.glUniform1i(mSamplerLoc, 0);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.length,
            GLES20.GL_UNSIGNED_SHORT, drawListBuffer);
    GLES20.glDisableVertexAttribArray(mPositionHandle);
    GLES20.glDisableVertexAttribArray(mTexCoordLoc);
    GLES20.glDisable(GLES20.GL_BLEND_COLOR);
}
 
開發者ID:sakkeerhussain,項目名稱:SpriteKit-Android,代碼行數:26,代碼來源:Sprite.java

示例2: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
void draw(MatrixManager matrixManager) {
    if (checkRunOnDraw(matrixManager)) {
        if (isVisible()) {
            mIsCurrent.value(true);
            GLES20.glDisable(GLES20.GL_CULL_FACE);
            GLES20.glFrontFace(GLES20.GL_CCW);
            if (mEnableDepthTest) {
                GLES20.glEnable(GLES20.GL_DEPTH_TEST);
                GLES20.glDepthFunc(GLES20.GL_LEQUAL);
                GLES20.glDepthMask(true);
            } else {
                GLES20.glDisable(GLES20.GL_DEPTH_TEST);
            }
            if (mEnableBlend) {
                GLES20.glEnable(GLES20.GL_BLEND);
                GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
            } else {
                GLES20.glDisable(GLES20.GL_BLEND);
            }
            drawModel(matrixManager);
            GLES20.glDisable(GLES20.GL_DEPTH_TEST);
            GLES20.glDisable(GLES20.GL_BLEND);
            mIsCurrent.value(false);
        }
        doUpdaterStartedAndStopped();
    }
}
 
開發者ID:gplibs,項目名稱:android-magic-surface-view,代碼行數:28,代碼來源:MagicBaseSurface.java

示例3: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Draws the AR background image.  The image will be drawn such that virtual content rendered
 * with the matrices provided by {@link Frame#getViewMatrix(float[], int)} and
 * {@link Session#getProjectionMatrix(float[], int, float, float)} will accurately follow
 * static physical objects.  This must be called <b>before</b> drawing virtual content.
 *
 * @param frame The last {@code Frame} returned by {@link Session#update()}.
 */
public void draw(Frame frame) {
    // If display rotation changed (also includes view size change), we need to re-query the uv
    // coordinates for the screen rect, as they may have changed as well.
    if (frame.isDisplayRotationChanged()) {
        frame.transformDisplayUvCoords(mQuadTexCoord, mQuadTexCoordTransformed);
    }

    // No need to test or write depth, the screen quad has arbitrary depth, and is expected
    // to be drawn first.
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);
    GLES20.glDepthMask(false);

    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureId);

    GLES20.glUseProgram(mQuadProgram);

    // Set the vertex positions.
    GLES20.glVertexAttribPointer(
        mQuadPositionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, mQuadVertices);

    // Set the texture coordinates.
    GLES20.glVertexAttribPointer(mQuadTexCoordParam, TEXCOORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false, 0, mQuadTexCoordTransformed);

    // Enable vertex arrays
    GLES20.glEnableVertexAttribArray(mQuadPositionParam);
    GLES20.glEnableVertexAttribArray(mQuadTexCoordParam);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

    // Disable vertex arrays
    GLES20.glDisableVertexAttribArray(mQuadPositionParam);
    GLES20.glDisableVertexAttribArray(mQuadTexCoordParam);

    // Restore the depth state for further drawing.
    GLES20.glDepthMask(true);
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
開發者ID:googlevr,項目名稱:poly-sample-android,代碼行數:49,代碼來源:BackgroundRenderer.java

示例4: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Draws the AR background image.  The image will be drawn such that virtual content rendered
 * with the matrices provided by {@link Frame#getViewMatrix(float[], int)} and
 * {@link Session#getProjectionMatrix(float[], int, float, float)} will accurately follow
 * static physical objects.  This must be called <b>before</b> drawing virtual content.
 *
 * @param frame The last {@code Frame} returned by {@link Session#update()}.
 */
public void draw(Frame frame) {
    // If display rotation changed (also includes view size change), we need to re-query the uv
    // coordinates for the screen rect, as they may have changed as well.
    if (frame.isDisplayRotationChanged()) {
        frame.transformDisplayUvCoords(mQuadTexCoord, mQuadTexCoordTransformed);
    }

    // No need to test or write depth, the screen quad has arbitrary depth, and is expected
    // to be drawn first.
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);
    GLES20.glDepthMask(false);

    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureId);

    GLES20.glUseProgram(mQuadProgram);

    // Set the vertex positions.
    GLES20.glVertexAttribPointer(
            mQuadPositionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, mQuadVertices);

    // Set the texture coordinates.
    GLES20.glVertexAttribPointer(mQuadTexCoordParam, TEXCOORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false, 0, mQuadTexCoordTransformed);

    // Enable vertex arrays
    GLES20.glEnableVertexAttribArray(mQuadPositionParam);
    GLES20.glEnableVertexAttribArray(mQuadTexCoordParam);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

    // Disable vertex arrays
    GLES20.glDisableVertexAttribArray(mQuadPositionParam);
    GLES20.glDisableVertexAttribArray(mQuadTexCoordParam);

    // Restore the depth state for further drawing.
    GLES20.glDepthMask(true);
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
開發者ID:nimbl3,項目名稱:nimbl3-arcore,代碼行數:49,代碼來源:BackgroundRenderer.java


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