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