OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Skybox.cpp File Reference
#include "Image.h"
#include "Quaternions.h"
#include "Text.h"
#include "Skybox.h"
#include <jni.h>
#include <GLES3/gl3.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>

Go to the source code of this file.

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...
 
void setup_graphics (int width, int height)
 
void render_frame (void)
 Renders a single frame. More...
 
void cleanup_graphics (void)
 Perform graphics clean-up actions. More...
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_init (JNIEnv *, jobject, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_step (JNIEnv *, jobject)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_uninit (JNIEnv *, jobject)
 

Variables

unsigned int window_width = 0
 
unsigned int window_height = 0
 
GLint location_viewMat = 0
 
GLuint program_id = 0
 
Quaternion Q_X = { 0.0f, 0.0f, 0.0f, 0.0f }
 
Quaternion Q_Y = { 0.0f, 0.0f, 0.0f, 0.0f }
 
Quaternion Q_Z = { 0.0f, 0.0f, 0.0f, 0.0f }
 
Quaternion Q_XY = { 0.0f, 0.0f, 0.0f, 0.0f }
 
Quaternion Q_XYZ = { 0.0f, 0.0f, 0.0f, 0.0f }
 
ImageFile cubemap_image = { 0, 0, NULL }
 
Texttext = NULL
 
GLuint cubemap_texture = 0
 
float roll = 0.0f
 
float pitch = 0.0f
 
float yaw = 0.0f
 
float model_view_matrix [16] = {0.0f}
 

Function Documentation

void cleanup_graphics ( void  )

Perform graphics clean-up actions.

Definition at line 319 of file Skybox.cpp.

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 110 of file Skybox.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_init ( JNIEnv *  ,
jobject  ,
jint  width,
jint  height 
)

Definition at line 336 of file Skybox.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_step ( JNIEnv *  ,
jobject   
)

Definition at line 341 of file Skybox.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_skybox_NativeLibrary_uninit ( JNIEnv *  ,
jobject   
)

Definition at line 346 of file Skybox.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 69 of file Skybox.cpp.

void render_frame ( void  )

Renders a single frame.

Definition at line 242 of file Skybox.cpp.

void setup_graphics ( int  width,
int  height 
)

Definition at line 157 of file Skybox.cpp.

Variable Documentation

ImageFile cubemap_image = { 0, 0, NULL }

Definition at line 54 of file Skybox.cpp.

GLuint cubemap_texture = 0

Definition at line 60 of file Skybox.cpp.

GLint location_viewMat = 0

Definition at line 39 of file Skybox.cpp.

float model_view_matrix[16] = {0.0f}

Definition at line 66 of file Skybox.cpp.

float pitch = 0.0f

Definition at line 63 of file Skybox.cpp.

GLuint program_id = 0

Definition at line 42 of file Skybox.cpp.

Quaternion Q_X = { 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 45 of file Skybox.cpp.

Quaternion Q_XY = { 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 50 of file Skybox.cpp.

Quaternion Q_XYZ = { 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 51 of file Skybox.cpp.

Quaternion Q_Y = { 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 46 of file Skybox.cpp.

Quaternion Q_Z = { 0.0f, 0.0f, 0.0f, 0.0f }

Definition at line 47 of file Skybox.cpp.

float roll = 0.0f

Definition at line 63 of file Skybox.cpp.

Text* text = NULL

Definition at line 57 of file Skybox.cpp.

unsigned int window_height = 0

Definition at line 34 of file Skybox.cpp.

unsigned int window_width = 0

Definition at line 33 of file Skybox.cpp.

float yaw = 0.0f

Definition at line 63 of file Skybox.cpp.