replicant-frameworks_native/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp

20 lines
664 B
C++
Raw Normal View History

#include <stdlib.h>
/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
GLint infoLen = 0;
glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
if (!infoLen) {
return _env->NewStringUTF("");
}
char* buf = (char*) malloc(infoLen);
if (buf == NULL) {
jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
return NULL;
}
glGetProgramInfoLog(shader, infoLen, NULL, buf);
jstring result = _env->NewStringUTF(buf);
free(buf);
return result;
}