OpenGL ES SDK for Android
ARM Developer Center
|
#include <jni.h>
#include <GLES3/gl3.h>
#include <cstdlib>
#include <cmath>
#include <string>
#include "Text.h"
#include "AstcTextures.h"
#include "Timer.h"
#include "SolidSphere.h"
Go to the source code of this file.
Functions | |
const string | resource_directory ("/data/data/com.arm.malideveloper.openglessdk.astctextures/files/") |
GLint | get_and_check_attrib_location (GLuint program, const GLchar *attrib_name) |
Invoke glGetAttribLocation(), if it has returned a positive value. Otherwise, print a message and exit. Function used for clarity reasons. More... | |
GLint | get_and_check_uniform_location (GLuint program, const GLchar *uniform_name) |
Invoke glGetUniformLocation, if it has returned a positive value. Otherwise, print a message and exit. Function used for clarity reasons. More... | |
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 | update_texture_bindings (bool force_switch_texture) |
Update texture bindings and text presented by text renderer. More... | |
GLuint | load_texture (const char *file_name, GLenum compressed_data_internal_format) |
Define and retrieve compressed texture image. More... | |
void | load_textures (void) |
Define 32 texture sets that the demo will switch between every 5 seconds. More... | |
void | setup_program (void) |
This function sets up a program object that will be used for rendering, as well as retrieves attribute & uniform locations. More... | |
void | load_buffer_data (void) |
Sets up a buffer object that will hold mesh data (vertex positions, normal vectors, textures UV coordinates). 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_astctextures_NativeLibrary_init (JNIEnv *, jobject, jint width, jint height) |
JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_astctextures_NativeLibrary_step (JNIEnv *, jobject) |
JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_astctextures_NativeLibrary_uninit (JNIEnv *, jobject) |
Perform graphics clean-up actions.
Definition at line 646 of file AstcTextures.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.
Definition at line 229 of file AstcTextures.cpp.
GLint get_and_check_attrib_location | ( | GLuint | program, |
const GLchar * | attrib_name | ||
) |
Invoke glGetAttribLocation(), if it has returned a positive value. Otherwise, print a message and exit. Function used for clarity reasons.
[in] | program | OpenGL ES specific. |
[in] | attrib_name | OpenGL ES specific. |
Definition at line 160 of file AstcTextures.cpp.
GLint get_and_check_uniform_location | ( | GLuint | program, |
const GLchar * | uniform_name | ||
) |
Invoke glGetUniformLocation, if it has returned a positive value. Otherwise, print a message and exit. Function used for clarity reasons.
[in] | program | OpenGL ES specific. |
[in] | uniform_name | OpenGL ES specific. |
Definition at line 174 of file AstcTextures.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_astctextures_NativeLibrary_init | ( | JNIEnv * | , |
jobject | , | ||
jint | width, | ||
jint | height | ||
) |
Definition at line 686 of file AstcTextures.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_astctextures_NativeLibrary_step | ( | JNIEnv * | , |
jobject | |||
) |
Definition at line 691 of file AstcTextures.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_astctextures_NativeLibrary_uninit | ( | JNIEnv * | , |
jobject | |||
) |
Definition at line 696 of file AstcTextures.cpp.
Sets up a buffer object that will hold mesh data (vertex positions, normal vectors, textures UV coordinates).
Definition at line 475 of file AstcTextures.cpp.
Create shader object and compile its source code.
Definition at line 188 of file AstcTextures.cpp.
Define and retrieve compressed texture image.
[in] | file_name | Texture file name. |
[in] | compressed_data_internal_format | ASTC compression internal format. |
Definition at line 329 of file AstcTextures.cpp.
Define 32 texture sets that the demo will switch between every 5 seconds.
Definition at line 424 of file AstcTextures.cpp.
Renders a single frame.
Definition at line 599 of file AstcTextures.cpp.
const string resource_directory | ( | "/data/data/com.arm.malideveloper.openglessdk.astctextures/files/" | ) |
Definition at line 552 of file AstcTextures.cpp.
This function sets up a program object that will be used for rendering, as well as retrieves attribute & uniform locations.
Definition at line 451 of file AstcTextures.cpp.
void update_texture_bindings | ( | bool | force_switch_texture | ) |
Update texture bindings and text presented by text renderer.
[in] | force_switch_texture | If true texture is immediately switched, if false texture is switched after interval passes. |
Definition at line 282 of file AstcTextures.cpp.
float angle_x = 0 |
Definition at line 94 of file AstcTextures.cpp.
float angle_y = 0 |
Definition at line 95 of file AstcTextures.cpp.
float angle_z = 0 |
Definition at line 96 of file AstcTextures.cpp.
GLuint bo_id = 0 |
Definition at line 81 of file AstcTextures.cpp.
GLint cloud_texture_location = 0 |
Definition at line 67 of file AstcTextures.cpp.
unsigned int current_texture_set_id = 0 |
Definition at line 114 of file AstcTextures.cpp.
float current_time = 0 |
Definition at line 99 of file AstcTextures.cpp.
GLint daytime_texture_location = 0 |
Definition at line 68 of file AstcTextures.cpp.
Definition at line 57 of file AstcTextures.cpp.
Timer fps_timer |
Definition at line 40 of file AstcTextures.cpp.
GLuint frag_shader_id = 0 |
Definition at line 85 of file AstcTextures.cpp.
Matrix model_view_matrix |
Definition at line 102 of file AstcTextures.cpp.
GLint mv_location = 0 |
Definition at line 72 of file AstcTextures.cpp.
GLint mvp_location = 0 |
Definition at line 73 of file AstcTextures.cpp.
Matrix mvp_matrix |
Definition at line 105 of file AstcTextures.cpp.
const int n_texture_ids = sizeof(texture_sets_info) / sizeof(texture_sets_info[0]) |
Definition at line 154 of file AstcTextures.cpp.
GLint nighttime_texture_location = 0 |
Definition at line 69 of file AstcTextures.cpp.
GLint normal_location = 0 |
Definition at line 76 of file AstcTextures.cpp.
Matrix perspective_matrix |
Definition at line 108 of file AstcTextures.cpp.
GLint position_location = 0 |
Definition at line 77 of file AstcTextures.cpp.
GLuint program_id = 0 |
Definition at line 88 of file AstcTextures.cpp.
Matrix rotate_matrix |
Definition at line 111 of file AstcTextures.cpp.
SolidSphere* solid_sphere = NULL |
Definition at line 47 of file AstcTextures.cpp.
unsigned short* sphere_indices = NULL |
Definition at line 117 of file AstcTextures.cpp.
int sphere_indices_size = 0 |
Definition at line 116 of file AstcTextures.cpp.
Text* text_displayer = NULL |
Definition at line 44 of file AstcTextures.cpp.
GLint texture_coords_location = 0 |
Definition at line 78 of file AstcTextures.cpp.
texture_set texture_ids[n_texture_ids] = { 0 } |
Definition at line 157 of file AstcTextures.cpp.
texture_set_info texture_sets_info[] |
Definition at line 120 of file AstcTextures.cpp.
Timer timer |
Definition at line 37 of file AstcTextures.cpp.
GLuint vao_id = 0 |
Definition at line 91 of file AstcTextures.cpp.
GLuint vert_shader_id = 0 |
Definition at line 84 of file AstcTextures.cpp.
int window_height = 0 |
Definition at line 54 of file AstcTextures.cpp.
int window_width = 0 |
Definition at line 53 of file AstcTextures.cpp.
float x_to_y_ratio = 0 |
Definition at line 60 of file AstcTextures.cpp.
const float z_far = 100.0f |
Definition at line 64 of file AstcTextures.cpp.
const float z_near = 0.01f |
Definition at line 63 of file AstcTextures.cpp.