compile opengl Shader - Java javax.media.opengl

Java examples for javax.media.opengl:Shader

Description

compile opengl Shader

Demo Code


import javax.media.opengl.GL2;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.charset.Charset;

public class Main{
    public static int compileShader(GL2 gl, int type, String source) {
        int shader = gl.glCreateShader(type);

        gl.glShaderSource(shader, 1, new String[] { source }, (int[]) null,
                0);//from  w  ww  .  ja v  a2  s. co m
        gl.glCompileShader(shader);

        return shader;
    }
}

Related Tutorials