zoukankan      html  css  js  c++  java
  • OpenGL es2.0 加载纹理图片和CubMap

    public static int initTexture(int drawableId, Resources resources) {
    int[] textures = new int[1];
    GLES20.glGenTextures(1, textures, 0);
    int textureId = textures[0];
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_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);
    
    
    InputStream is = resources.openRawResource(drawableId);
    Bitmap bitmapTmp;
    try {
    bitmapTmp = BitmapFactory.decodeStream(is);
    } finally {
    try {
    is.close();
    } catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    }
    GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmapTmp, 0);
    bitmapTmp.recycle();
    return textureId;
    }
  • 相关阅读:
    图像滤波
    直方图histeq
    直方图
    基于灰度变换的图像增强
    图像增强
    图像旋转和缩放
    图像点运算
    像素的连接与联通
    程序员进阶之算法练习(一)
    RxSwift 系列(二)
  • 原文地址:https://www.cnblogs.com/Anzhongliu/p/6092122.html
Copyright © 2011-2022 走看看