2011-04-09 03:01:01 +00:00
|
|
|
#include <stdlib.h>
|
2009-11-19 08:34:55 +00:00
|
|
|
|
|
|
|
/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
|
2011-04-09 03:01:01 +00:00
|
|
|
static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
|
2009-11-19 08:34:55 +00:00
|
|
|
GLint infoLen = 0;
|
|
|
|
glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
|
2011-04-09 03:01:01 +00:00
|
|
|
if (!infoLen) {
|
|
|
|
return _env->NewStringUTF("");
|
2009-11-19 08:34:55 +00:00
|
|
|
}
|
2011-04-09 03:01:01 +00:00
|
|
|
char* buf = (char*) malloc(infoLen);
|
|
|
|
if (buf == NULL) {
|
|
|
|
jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
|
|
|
|
return NULL;
|
2009-11-19 08:34:55 +00:00
|
|
|
}
|
2011-04-09 03:01:01 +00:00
|
|
|
glGetProgramInfoLog(shader, infoLen, NULL, buf);
|
|
|
|
jstring result = _env->NewStringUTF(buf);
|
|
|
|
free(buf);
|
|
|
|
return result;
|
|
|
|
}
|