当前位置: 首页>>代码示例>>Java>>正文


Java GLES20.GL_TEXTURE_2D属性代码示例

本文整理汇总了Java中android.opengl.GLES20.GL_TEXTURE_2D属性的典型用法代码示例。如果您正苦于以下问题:Java GLES20.GL_TEXTURE_2D属性的具体用法?Java GLES20.GL_TEXTURE_2D怎么用?Java GLES20.GL_TEXTURE_2D使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.GL_TEXTURE_2D属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onInitTextureExt

private void onInitTextureExt(boolean isForExternalTextureInput) {
    mTextureTarget = GLES20.GL_TEXTURE_2D;
    if (isForExternalTextureInput) {
        mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
        mFragmentShader = "#extension GL_OES_EGL_image_external : require\n" +
                mFragmentShader.replace("uniform sampler2D inputImageTexture;",
                        "uniform samplerExternalOES inputImageTexture;");


        int[] textures = new int[1];
        GLES20.glGenTextures(1, textures, 0);

        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);

        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
                GLES20.GL_NEAREST);
        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
                GLES20.GL_LINEAR);
        GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S,
                GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T,
                GLES20.GL_CLAMP_TO_EDGE);

        mSysRenderTexture = textures[0];

    }
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:28,代码来源:GPUImageFilter.java

示例2: Texture2dProgram

/**
 * Prepares the program in the current EGL context.
 */
public Texture2dProgram(ProgramType programType) {
    mProgramType = programType;

    switch (programType) {
        case TEXTURE_2D:
            mTextureTarget = GLES20.GL_TEXTURE_2D;
            mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_2D);
            break;
        case TEXTURE_EXT:
            mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
            mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT);
            break;
        case TEXTURE_EXT_BW:
            mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
            mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT_BW);
            break;
        case TEXTURE_EXT_FILT:
            mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
            mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT_FILT);
            break;
        default:
            throw new RuntimeException("Unhandled type " + programType);
    }
    if (mProgramHandle == 0) {
        throw new RuntimeException("Unable to create program");
    }
    Log.d(TAG, "Created program " + mProgramHandle + " (" + programType + ")");

    // get locations of attributes and uniforms

    maPositionLoc = GLES20.glGetAttribLocation(mProgramHandle, "aPosition");
    GlUtil.checkLocation(maPositionLoc, "aPosition");
    maTextureCoordLoc = GLES20.glGetAttribLocation(mProgramHandle, "aTextureCoord");
    GlUtil.checkLocation(maTextureCoordLoc, "aTextureCoord");
    muMVPMatrixLoc = GLES20.glGetUniformLocation(mProgramHandle, "uMVPMatrix");
    GlUtil.checkLocation(muMVPMatrixLoc, "uMVPMatrix");
    muTexMatrixLoc = GLES20.glGetUniformLocation(mProgramHandle, "uTexMatrix");
    GlUtil.checkLocation(muTexMatrixLoc, "uTexMatrix");
    muKernelLoc = GLES20.glGetUniformLocation(mProgramHandle, "uKernel");
    if (muKernelLoc < 0) {
        // no kernel in this one
        muKernelLoc = -1;
        muTexOffsetLoc = -1;
        muColorAdjustLoc = -1;
    } else {
        // has kernel, must also have tex offset and color adj
        muTexOffsetLoc = GLES20.glGetUniformLocation(mProgramHandle, "uTexOffset");
        GlUtil.checkLocation(muTexOffsetLoc, "uTexOffset");
        muColorAdjustLoc = GLES20.glGetUniformLocation(mProgramHandle, "uColorAdjust");
        GlUtil.checkLocation(muColorAdjustLoc, "uColorAdjust");

        // initialize default values
        setKernel(new float[] {0f, 0f, 0f,  0f, 1f, 0f,  0f, 0f, 0f}, 0f);
        setTexSize(256, 256);
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:59,代码来源:Texture2dProgram.java

示例3: getTextureTarget

@Override public int getTextureTarget() {
    //return GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
    return GLES20.GL_TEXTURE_2D;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:4,代码来源:FilterGroup.java

示例4: getTextureTarget

@Override public int getTextureTarget() {
    return GLES20.GL_TEXTURE_2D;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:3,代码来源:ImageFilterGaussianSingleBlur.java


注:本文中的android.opengl.GLES20.GL_TEXTURE_2D属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。