1 #include <stdlib.h>
2 
3 /* void glGetProgramPipelineInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
android_glGetProgramPipelineInfoLog(JNIEnv * _env,jobject,jint shader)4 static jstring android_glGetProgramPipelineInfoLog(JNIEnv *_env, jobject, jint shader) {
5     GLint infoLen = 0;
6     glGetProgramPipelineiv(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/OutOfMemoryError", "out of memory");
13         return NULL;
14     }
15     glGetProgramPipelineInfoLog(shader, infoLen, NULL, buf);
16     jstring result = _env->NewStringUTF(buf);
17     free(buf);
18     return result;
19 }
20