1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| private String [] chaine = null ;
public LoadGlslShader(GL gl)
{
int vsh = gl.glCreateShader(GL.GL_VERTEX_SHADER);
int fsh = gl.glCreateShader(GL.GL_FRAGMENT_SHADER);
readFile(new String("vertexShader.txt"));
gl.glShaderSource(vsh, 1, chaine, (int[])null, 0);
chaine = null ;
readFile(new String("fragmentShader.txt"));
gl.glShaderSource(fsh, 1, chaine, (int[])null, 0);
chaine = null ;
gl.glCompileShader(vsh);
gl.glCompileShader(fsh);
int ph = gl.glCreateProgram();//program handler
gl.glAttachShader(ph, vsh);
gl.glAttachShader(ph, fsh);
gl.glLinkProgram(ph);
gl.glValidateProgram(ph);
gl.glUseProgram(ph);
} |
Partager