compile opengl Fragment Shader - Android android.opengl

Android examples for android.opengl:OpenGL Shader

Description

compile opengl Fragment Shader

Demo Code


//package com.java2s;

import android.opengl.GLES20;

public class Main {
    public static int compileFragmentShader(String shaderCode) {
        return compileShader(GLES20.GL_FRAGMENT_SHADER, shaderCode);
    }//from ww  w .  j  av a 2  s.c  o  m

    private static int compileShader(int type, String shaderCode) {
        final int shader = GLES20.glCreateShader(type);
        GLES20.glShaderSource(shader, shaderCode);
        GLES20.glCompileShader(shader);
        return shader;
    }
}

Related Tutorials