Android examples for android.opengl:OpenGL Shader
OpenGL compile Shader
//package com.java2s; import android.opengl.GLES20; public class Main { private static int compileShader(final int shaderType, final String shader) { int handle = GLES20.glCreateShader(shaderType); if (handle != 0) { GLES20.glShaderSource(handle, shader); GLES20.glCompileShader(handle); final int[] compileStatus = new int[1]; GLES20.glGetShaderiv(handle, GLES20.GL_COMPILE_STATUS, compileStatus, 0);/*from ww w. j a v a 2 s . c o m*/ if (compileStatus[0] == 0) { GLES20.glDeleteShader(handle); handle = 0; } } if (handle == 0) throw new RuntimeException("Error creating the " + shaderType + " shader"); return handle; } }