Home | History | Annotate | Download | only in gles11
      1 #include <stdlib.h>
      2 
      3 /* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
      4 static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
      5     GLint infoLen = 0;
      6     glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
      7     if (!infoLen) {
      8         return _env->NewStringUTF("");
      9     }
     10     char* buf = (char*) malloc(infoLen);
     11     if (buf == NULL) {
     12         jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
     13         return NULL;
     14     }
     15     glGetProgramInfoLog(shader, infoLen, NULL, buf);
     16     jstring result = _env->NewStringUTF(buf);
     17     free(buf);
     18     return result;
     19 }
     20