24 #include <android/log.h>
25 #include <GLES3/gl3.h>
27 #define LOG_TAG "libNative"
28 #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
29 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
30 #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
31 #define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)
33 #define MALLOC_CHECK(ptr_type, ptr, size) \
35 ptr = (ptr_type) malloc(size); \
38 LOGF("Memory allocation error FILE: %s LINE: %i\n", __FILE__, __LINE__); \
43 #define REALLOC_CHECK(ptr_type, ptr, size) \
45 ptr = (ptr_type) realloc(ptr, size); \
48 LOGF("Memory allocation error FILE: %s LINE: %i\n", __FILE__, __LINE__); \
53 #define FREE_CHECK(ptr) \
62 GLenum glError = glGetError(); \
63 if(glError != GL_NO_ERROR) \
65 LOGE("glGetError() = %i (%#.8x) at %s:%i\n", glError, glError, __FILE__, __LINE__); \
74 "out vec3 texCoord;\n"
75 "uniform mat4 viewMat;\n"
77 " const vec3 vertices[4] = vec3[4](vec3(-1.0f, -1.0f, 1.0f),\n"
78 " vec3( 1.0f, -1.0f, 1.0f),\n"
79 " vec3(-1.0f, 1.0f, 1.0f),\n"
80 " vec3( 1.0f, 1.0f, 1.0f));\n"
81 " texCoord = mat3(viewMat) * vertices[gl_VertexID];\n"
82 " gl_Position = vec4(vertices[gl_VertexID], 1.0f);\n"
90 "precision mediump float;\n"
93 "uniform samplerCube texCubemap; \n"
95 " color = texture(texCubemap, texCoord);\n"
const char skybox_vertex_shader_source[]
const char skybox_fragment_shader_source[]
GLuint create_program(const char *vertex_source, const char *fragment_source)
Create program object, attach vertex and fragment shader to it. Link program object and check whether...
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLuint load_shader(GLenum shader_type, const char *shader_source)
Create shader object and compile its source code.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count