您当前的位置: 首页 > 

鱼儿-1226

暂无认证

  • 0浏览

    0关注

    1100博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

openGL ES美颜滤镜之美白,磨皮,红润

鱼儿-1226 发布时间:2020-08-11 10:26:26 ,浏览量:0

下面是滤镜源码:


import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.view.WindowManager;

import com.ws.gl.opengltexture.programs.TextureShaderProgram;
import com.ws.gl.opengltexture.util.GLBitmapUtils;
import com.ws.gl.opengltexture.util.MatrixHelper;
import com.ws.gl.opengltexture.util.TextureHelper;
import com.ws.ijk.openglpicture.R;

import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;



public class BeautyRenderer implements GLSurfaceView.Renderer{

    public static final String VERTEX_SHADER = "" +
            "attribute vec4 vPosition;\n" +
            "uniform mat4 vMatrix;\n"+
            "attribute vec2 vCoordinate;\n" +
            " \n" +
            "varying vec2 textureCoordinate;\n" +
            " \n" +
            "void main()\n" +
            "{\n" +
            "    gl_Position =vMatrix* vPosition;\n" +
            "    textureCoordinate = vCoordinate;\n" +
            "}";

    public static final String BILATERAL_FRAGMENT_SHADER = "" +
            "precision highp float;\n"+
            "   varying highp vec2 textureCoordinate;\n" +
            "\n" +
            "    uniform sampler2D vTexture;\n" +
            "\n" +
            "    uniform highp vec2 singleStepOffset;\n" +
            "    uniform highp vec4 params;\n" +
            "    uniform highp float brightness;\n" +
            "    uniform float texelWidthOffset;\n"+
            "    uniform float texelHeightOffset;\n"+
            "\n" +
            "    const highp vec3 W = vec3(0.299, 0.587, 0.114);\n" +
            "    const highp mat3 saturateMatrix = mat3(\n" +
            "        1.1102, -0.0598, -0.061,\n" +
            "        -0.0774, 1.0826, -0.1186,\n" +
            "        -0.0228, -0.0228, 1.1772);\n" +
            "    highp vec2 blurCoordinates[24];\n" +
            "\n" +
            "    highp float hardLight(highp float color) {\n" +
            "    if (color             
关注
打赏
1604459285
查看更多评论
0.0410s