當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。