23 #define LOG_TAG "libNative"
24 #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
31 GLint compilationStatus = GL_FALSE;
34 *shaderPtr =
GL_CHECK(glCreateShader(shaderType));
36 GL_CHECK(glShaderSource(*shaderPtr, 1, &shaderSourcePtr, NULL));
39 GL_CHECK(glCompileShader(*shaderPtr));
41 GL_CHECK(glGetShaderiv(*shaderPtr, GL_COMPILE_STATUS, &compilationStatus));
44 if(compilationStatus != GL_TRUE)
47 char *debugSource = NULL;
48 char *errorLog = NULL;
51 GL_CHECK(glGetShaderiv(*shaderPtr, GL_SHADER_SOURCE_LENGTH, &length));
53 debugSource = (
char *)malloc(length);
55 GL_CHECK(glGetShaderSource(*shaderPtr, length, NULL, debugSource));
57 LOGE(
"Debug source START:\n%s\nDebug source END\n\n", debugSource);
62 GL_CHECK(glGetShaderiv(*shaderPtr, GL_INFO_LOG_LENGTH, &length));
64 errorLog = (
char *)malloc(length);
66 GL_CHECK(glGetShaderInfoLog(*shaderPtr, length, NULL, errorLog));
68 LOGE(
"Log START:\n%s\nLog END\n\n", errorLog);
72 LOGE(
"Compilation FAILED!\n\n");
GLenum GLuint GLenum GLsizei length
static void processShader(GLuint *shader, const char *filename, GLint shaderType)
Create shader, load in source, compile, and dump debug as necessary.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count