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


Java GLES20.glTexParameterf方法代碼示例

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


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

示例1: loadTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadTexture(Bitmap bitmap, boolean recycle) {
    if (bitmap == null) {
        return 0;
    }
    int textures[] = new int[1];
    GLES20.glGenTextures(1, textures, 0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
    if (recycle) {
        bitmap.recycle();
    }
    return textures[0];
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:18,代碼來源:OpenGLUtils.java

示例2: createTextureObject

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Creates a texture object suitable for use with this program.
 * <p>
 * On exit, the texture will be bound.
 */
public int createTextureObject() {
    int[] textures = new int[1];
    GLES20.glGenTextures(1, textures, 0);
    GlUtil.checkGlError("glGenTextures");

    int texId = textures[0];
    GLES20.glBindTexture(mTextureTarget, texId);
    GlUtil.checkGlError("glBindTexture " + texId);

    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);
    GlUtil.checkGlError("glTexParameter");

    return texId;
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:27,代碼來源:Texture2dProgram.java

示例3: loadTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadTexture(final IntBuffer data, final Size size, final int usedTexId) {
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, size.width, size.height,
                0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, size.width,
                size.height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
        textures[0] = usedTexId;
    }
    return textures[0];
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:24,代碼來源:OpenGlUtils.java

示例4: createFrameBuffer

import android.opengl.GLES20; //導入方法依賴的package包/類
public void createFrameBuffer(int width, int height, int[] frameBuffer, int[] frameBufferTexture, int frameBufferSize) {
    for (int i = 0; i < frameBufferSize; i++) {

        GLES20.glGenTextures(1, frameBufferTexture, i);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, frameBufferTexture[i]);
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
                GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

        GLES20.glGenFramebuffers(1, frameBuffer, i);
        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffer[i]);
        GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
                GLES20.GL_TEXTURE_2D, frameBufferTexture[i], 0);

        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
    }
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:26,代碼來源:SurfaceRenderer.java

示例5: loadTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadTexture(Buffer paramBuffer, int paramInt1, int paramInt2, int paramInt3)
{
    int[] arrayOfInt = new int[1];
    if (paramInt3 == -1)
    {
        GLES20.glGenTextures(1, arrayOfInt, 0);
        GLES20.glBindTexture(3553, arrayOfInt[0]);
        GLES20.glTexParameterf(3553, 10240, 9729.0F);

        GLES20.glTexParameterf(3553, 10241, 9729.0F);

        GLES20.glTexParameterf(3553, 10242, 33071.0F);

        GLES20.glTexParameterf(3553, 10243, 33071.0F);

        GLES20.glTexImage2D(3553, 0, 6408, paramInt1, paramInt2, 0, 6408, 5121, paramBuffer);
    }
    else
    {
        GLES20.glBindTexture(3553, paramInt3);
        GLES20.glTexSubImage2D(3553, 0, 0, 0, paramInt1, paramInt2, 6408, 5121, paramBuffer);

        arrayOfInt[0] = paramInt3;
    }
    return arrayOfInt[0];
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:27,代碼來源:OpenGlUtils.java

示例6: createTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Creates a texture object suitable for use with this program.
 * <p>
 * On exit, the texture will be bound.
 */
public int createTexture() {
    int[] textures = new int[1];
    GLES20.glGenTextures(1, textures, 0);

    int texId = textures[0];
    GLES20.glBindTexture(mTextureTarget, texId);

    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);

    return texId;
}
 
開發者ID:LeonHover,項目名稱:MediaCodecRecorder,代碼行數:24,代碼來源:GLSurfaceFilter.java

示例7: createExternalTextures

import android.opengl.GLES20; //導入方法依賴的package包/類
public static void createExternalTextures(int cantidad, int[] texturesId, int position) {
  GLES20.glGenTextures(cantidad, texturesId, position);
  for (int i = 0; i < cantidad; i++) {
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + position + i);
    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texturesId[position + i]);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
        GLES20.GL_LINEAR);
    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);
  }
}
 
開發者ID:pedroSG94,項目名稱:rtmp-rtsp-stream-client-java,代碼行數:16,代碼來源:GlUtil.java

示例8: create

import android.opengl.GLES20; //導入方法依賴的package包/類
FBO create(int width,int height){
    int[] frameBuffers = new int[1];
    int[] frameBufferTextures = new int[1];
    GLES20.glGenFramebuffers(1, frameBuffers, 0);

    GLES20.glGenTextures(1, frameBufferTextures, 0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, frameBufferTextures[0]);
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA,
            width,height, 0,
            GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[0]);
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
            GLES20.GL_TEXTURE_2D, frameBufferTextures[0], 0);

    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    frameBuffer=frameBuffers[0];
    frameBufferTexture=frameBufferTextures[0];
    return this;
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:31,代碼來源:FBO.java

示例9: loadTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
private int loadTexture(int resId) {
    final int[] textureIds = new int[1];
    GLES20.glGenTextures(1, textureIds, 0);

    if (textureIds[0] == 0) return -1;

    // do not scale the bitmap depending on screen density
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inScaled = false;

    final Bitmap textureBitmap = BitmapFactory.decodeResource(getResources(), resId, options);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureIds[0]);

    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);

    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);

    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);

    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

    GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, textureBitmap, 0);
    textureBitmap.recycle();

    return textureIds[0];
}
 
開發者ID:PacktPublishing,項目名稱:Building-Android-UIs-with-Custom-Views,代碼行數:31,代碼來源:GLDrawer.java

示例10: genOesTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int genOesTexture() {
    int[] textures = new int[1];
    GLES20.glGenTextures(1, textures, 0);
    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    return textures[0];
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:11,代碼來源:OpenGLUtils.java

示例11: initCameraFrameBuffer

import android.opengl.GLES20; //導入方法依賴的package包/類
public void initCameraFrameBuffer(int width, int height) {
	if(mFrameBuffers != null && (mFrameWidth != width || mFrameHeight != height))
		destroyFramebuffers();
       if (mFrameBuffers == null) {
       	mFrameWidth = width;
		mFrameHeight = height;
       	mFrameBuffers = new int[1];
           mFrameBufferTextures = new int[1];

           GLES20.glGenFramebuffers(1, mFrameBuffers, 0);
           
           GLES20.glGenTextures(1, mFrameBufferTextures, 0);
           GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0]);
           GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
                   GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
           GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                   GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
           GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                   GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
           GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                   GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
           GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                   GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

           GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);
           GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
                   GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);

           GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
           GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
       }
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:33,代碼來源:MagicVideoInputFilter.java

示例12: getTextureFromBitmap

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int getTextureFromBitmap(Bitmap bitmap,int imageSize[]){
    final int[] textureObjectIds=new int[1];
    GLES20.glGenTextures(1,textureObjectIds,0);
    if (textureObjectIds[0]==0){
        Log.d(TAG,"Failed at glGenTextures");
        return 0;
    }

    if (bitmap==null){
        Log.d(TAG,"Failed at decoding bitmap");
        GLES20.glDeleteTextures(1,textureObjectIds,0);
        return 0;
    }

    if(imageSize!=null && imageSize.length>=2){
        imageSize[0]=bitmap.getWidth();
        imageSize[1]=bitmap.getHeight();
    }

    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,textureObjectIds[0]);

    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    GLUtils.texImage2D(GLES20.GL_TEXTURE_2D,0,bitmap,0);
    bitmap.recycle();

    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,0);
    return textureObjectIds[0];
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:36,代碼來源:TextureUtils.java

示例13: onOutputSizeChanged

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onOutputSizeChanged(final int width, final int height) {
    super.onOutputSizeChanged(width, height);
    if (mFrameBuffers != null) {
        destroyFramebuffers();
    }

    int size = mFilters.size();
    for (int i = 0; i < size; i++) {
        mFilters.get(i).onOutputSizeChanged(width, height);
    }

    if (mMergedFilters != null && mMergedFilters.size() > 0) {
        size = mMergedFilters.size();
        mFrameBuffers = new int[size - 1];
        mFrameBufferTextures = new int[size - 1];

        for (int i = 0; i < size - 1; i++) {
            GLES20.glGenFramebuffers(1, mFrameBuffers, i);
            GLES20.glGenTextures(1, mFrameBufferTextures, i);
            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[i]);
            GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
                    GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                    GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                    GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                    GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                    GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[i]);
            GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
                    GLES20.GL_TEXTURE_2D, mFrameBufferTextures[i], 0);

            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
        }
    }
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:42,代碼來源:CameraFilterGroup.java

示例14: loadTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
private int loadTexture(int resource) {
    
    // In which ID will we be storing this texture?
    int id = newTextureID();

    // We need to flip the textures vertically:
    android.graphics.Matrix flip = new android.graphics.Matrix();
    flip.postScale(1f, -1f);
    
    // This will tell the BitmapFactory to not scale based on the device's pixel density:
    // (Thanks to Matthew Marshall for this bit)
    BitmapFactory.Options opts = new BitmapFactory.Options();
    opts.inScaled = false;

    // Load up, and flip the texture:
    Bitmap temp = BitmapFactory.decodeResource(_context.getResources(), resource, opts);
    Bitmap bmp = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), flip, true);
    temp.recycle();
    
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id);

    // Set all of our texture parameters:
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);
    
    // Generate, and load up all of the mipmaps:
    for(int level=0, height = bmp.getHeight(), width = bmp.getWidth(); true; level++) {
        // Push the bitmap onto the GPU:
        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, level, bmp, 0);
        
        // We need to stop when the texture is 1x1:
        if(height==1 && width==1) break;
        
        // Resize, and let's go again:
        width >>= 1; height >>= 1;
        if(width<1)  width = 1;
        if(height<1) height = 1;
        
        Bitmap bmp2 = Bitmap.createScaledBitmap(bmp, width, height, true);
        bmp.recycle();
        bmp = bmp2;
    }
    bmp.recycle();
    
    return id;
}
 
開發者ID:efroemling,項目名稱:bombsquad-remote-android,代碼行數:49,代碼來源:GLRenderer.java

示例15: onOutputSizeChanged

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
  public void onOutputSizeChanged(final int width, final int height) {
      super.onOutputSizeChanged(width, height);
      int size = mFilters.size();
      for (int i = 0; i < size; i++) {
          mFilters.get(i).onOutputSizeChanged(width, height);
      }
      if(mFrameBuffers != null && (mFrameWidth != width || mFrameHeight != height || mFrameBuffers.length != size-1)){
	destroyFramebuffers();
	mFrameWidth = width;
	mFrameHeight = height;
}
      if (mFrameBuffers == null) {
      	mFrameBuffers = new int[size-1];
          mFrameBufferTextures = new int[size-1];

          for (int i = 0; i < size-1; i++) {
              GLES20.glGenFramebuffers(1, mFrameBuffers, i);
              
              GLES20.glGenTextures(1, mFrameBufferTextures, i);
              GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[i]);
              GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
                      GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
              GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                      GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
              GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                      GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
              GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                      GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
              GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                      GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

              GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[i]);
              GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
                      GLES20.GL_TEXTURE_2D, mFrameBufferTextures[i], 0);

              GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
              GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
          }
      }
  }
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:42,代碼來源:MagicBaseGroupFilter.java


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