OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Skybox.h File Reference
#include <android/log.h>
#include <GLES3/gl3.h>

Go to the source code of this file.

Macros

#define LOG_TAG   "libNative"
 
#define LOGD(...)   __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
 
#define LOGI(...)   __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
 
#define LOGE(...)   __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
 
#define LOGF(...)   __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)
 
#define MALLOC_CHECK(ptr_type, ptr, size)
 
#define REALLOC_CHECK(ptr_type, ptr, size)
 
#define FREE_CHECK(ptr)
 
#define GL_CHECK(x)
 

Functions

GLuint load_shader (GLenum shader_type, const char *shader_source)
 Create shader object and compile its source code. More...
 
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 it has succeeded. More...
 

Variables

const char skybox_vertex_shader_source []
 
const char skybox_fragment_shader_source []
 

Macro Definition Documentation

#define FREE_CHECK (   ptr)
Value:
{ \
free((void*) ptr); \
ptr = NULL; \
}

Definition at line 53 of file Skybox.h.

#define GL_CHECK (   x)
Value:
x; \
{ \
GLenum glError = glGetError(); \
if(glError != GL_NO_ERROR) \
{ \
LOGE("glGetError() = %i (%#.8x) at %s:%i\n", glError, glError, __FILE__, __LINE__); \
exit(EXIT_FAILURE); \
} \
}
GLint GLint GLint GLint GLint x
Definition: gl2ext.h:574
#define LOGE(...)
Definition: Skybox.h:30
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)

Definition at line 59 of file Skybox.h.

#define LOG_TAG   "libNative"

Definition at line 27 of file Skybox.h.

#define LOGD (   ...)    __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)

Definition at line 28 of file Skybox.h.

#define LOGE (   ...)    __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

Definition at line 30 of file Skybox.h.

#define LOGF (   ...)    __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)

Definition at line 31 of file Skybox.h.

#define LOGI (   ...)    __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)

Definition at line 29 of file Skybox.h.

#define MALLOC_CHECK (   ptr_type,
  ptr,
  size 
)
Value:
{ \
ptr = (ptr_type) malloc(size); \
if (ptr == NULL) \
{ \
LOGF("Memory allocation error FILE: %s LINE: %i\n", __FILE__, __LINE__); \
exit(EXIT_FAILURE); \
} \
}
#define LOGF(...)
Definition: Skybox.h:31
GLenum GLuint GLintptr GLsizeiptr size
Definition: gl2ext.h:629

Definition at line 33 of file Skybox.h.

#define REALLOC_CHECK (   ptr_type,
  ptr,
  size 
)
Value:
{ \
ptr = (ptr_type) realloc(ptr, size); \
if (ptr == NULL) \
{ \
LOGF("Memory allocation error FILE: %s LINE: %i\n", __FILE__, __LINE__); \
exit(EXIT_FAILURE); \
} \
}
#define LOGF(...)
Definition: Skybox.h:31
GLenum GLuint GLintptr GLsizeiptr size
Definition: gl2ext.h:629

Definition at line 43 of file Skybox.h.

Function Documentation

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 it has succeeded.

Parameters
[in]vertex_sourceVertex or fragment shader.
[in]fragment_sourceShader source code.
Returns
Program object ID.

Definition at line 229 of file AstcTextures.cpp.

GLuint load_shader ( GLenum  shader_type,
const char *  shader_source 
)

Create shader object and compile its source code.

Parameters
[in]shader_typeVertex or fragment shader.
[in]shader_sourceShader source code.
Returns
Shader object ID.

Definition at line 188 of file AstcTextures.cpp.

Variable Documentation

const char skybox_fragment_shader_source[]
Initial value:
=
{
"#version 300 es\n"
"precision mediump float;\n"
"in vec3 texCoord;\n"
"out vec4 color;\n"
"uniform samplerCube texCubemap; \n"
"void main(void) {\n"
" color = texture(texCubemap, texCoord);\n"
"}\n"
}

Definition at line 87 of file Skybox.h.

const char skybox_vertex_shader_source[]
Initial value:
=
{
"#version 300 es\n"
"out vec3 texCoord;\n"
"uniform mat4 viewMat;\n"
"void main(void) {\n"
" const vec3 vertices[4] = vec3[4](vec3(-1.0f, -1.0f, 1.0f),\n"
" vec3( 1.0f, -1.0f, 1.0f),\n"
" vec3(-1.0f, 1.0f, 1.0f),\n"
" vec3( 1.0f, 1.0f, 1.0f));\n"
" texCoord = mat3(viewMat) * vertices[gl_VertexID];\n"
" gl_Position = vec4(vertices[gl_VertexID], 1.0f);\n"
"}\n"
}

Definition at line 71 of file Skybox.h.