当前位置: 首页>>代码示例>>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;未经允许,请勿转载。