Java tutorial
//package com.java2s; import android.opengl.GLES20; import android.util.Log; public class Main { private static final String TAG = "GL utils"; private static int compileShader(int target, String source, int[] output) { output[0] = GLES20.glCreateShader(target); // const GLchar *str = src.c_str(); GLES20.glShaderSource(output[0], source); GLES20.glCompileShader(output[0]); checkGLError("Compile shader"); int[] status = new int[1]; GLES20.glGetShaderiv(output[0], GLES20.GL_COMPILE_STATUS, status, 0); if (status[0] == 0) { Log.e(TAG, "Failed to compile shader: " + GLES20.glGetShaderInfoLog(output[0])); GLES20.glDeleteShader(output[0]); } return status[0]; } public static void checkGLError(String msg) { int error = GLES20.glGetError(); if (error != GLES20.GL_NO_ERROR) { String str = msg + ": glError 0x" + Integer.toHexString(error); Log.e(TAG, str); int values[] = new int[2]; GLES20.glGetIntegerv(GLES20.GL_ARRAY_BUFFER_BINDING, values, 0); GLES20.glGetIntegerv(GLES20.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, values, 1); Log.e(TAG, "Current bound array buffer: " + values[0]); Log.e(TAG, "Current bound vertex attrib: " + values[1]); throw new RuntimeException(msg); } } }