OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
app.cpp File Reference
#include <GLES3/gl3.h>
#include "app.h"
#include "glutil.h"
#include "timer.h"
#include "shader.h"
#include "common.h"
#include "primitives.h"
#include "meshloader.h"
#include <fstream>

Go to the source code of this file.

Macros

#define GL_EXT_shader_pixel_local_storage   1
 
#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT   0x8F63
 
#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT   0x8F67
 
#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT   0x8F64
 

Functions

bool init_app (int width, int height)
 
void free_app ()
 
void update_app (float dt)
 
void render_teapot (mat4 model, bool normal=true)
 
void render_sphere (mat4 model, bool normal=true)
 
void render_cube (mat4 model, bool normal=true)
 
void render_pass_thickness (bool second_pass)
 
void render_pass_shading ()
 
void render_pass_opaque ()
 
void render_pass_resolve ()
 
void render_app (float dt)
 
void on_pointer_down (float x, float y)
 
void on_pointer_up (float x, float y)
 

Variables

int window_width
 
int window_height
 
Shader shader_prepass
 
Shader shader_thickness
 
Shader shader_scattering
 
Shader shader_resolve
 
Shader shader_opaque
 
mat4 mat_projection
 
mat4 mat_view
 
Mesh quad
 
Mesh cube
 
Mesh teapot
 
Mesh sphere
 
const int num_lights = 2
 
vec3 light_pos [num_lights]
 
vec3 light_color [num_lights]
 
float light_intensity [num_lights]
 
float light_radius [num_lights]
 
static float model_scale = 0.01f
 
static float s_ambient = 0.20f
 
static float s_distortion = 0.07f
 
static float s_sharpness = 10.0f
 
static float s_scale = 3.50f
 
static float zoom = 3.0f
 
static float rot_x = -0.5f
 
static float rot_y = 0.0f
 
static float delta_x = 0.0f
 
static float delta_y = 0.0f
 
static float z_near = 0.1f
 
static float z_far = 15.0f
 
static float fov_y = PI / 4.0f
 
static float aspect_ratio = 1.0f
 
static bool dragging = false
 
static float last_x = 0.0f
 
static float last_y = 0.0f
 

Macro Definition Documentation

#define GL_EXT_shader_pixel_local_storage   1

Definition at line 32 of file app.cpp.

#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT   0x8F63

Definition at line 33 of file app.cpp.

#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT   0x8F67

Definition at line 34 of file app.cpp.

#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT   0x8F64

Definition at line 35 of file app.cpp.

Function Documentation

void free_app ( )

Definition at line 131 of file app.cpp.

bool init_app ( int  width,
int  height 
)

Definition at line 94 of file app.cpp.

void on_pointer_down ( float  x,
float  y 
)

Definition at line 321 of file app.cpp.

void on_pointer_up ( float  x,
float  y 
)

Definition at line 336 of file app.cpp.

void render_app ( float  dt)

Definition at line 262 of file app.cpp.

void render_cube ( mat4  model,
bool  normal = true 
)

Definition at line 175 of file app.cpp.

void render_pass_opaque ( )

Definition at line 240 of file app.cpp.

void render_pass_resolve ( )

Definition at line 254 of file app.cpp.

void render_pass_shading ( )

Definition at line 213 of file app.cpp.

void render_pass_thickness ( bool  second_pass)

Definition at line 184 of file app.cpp.

void render_sphere ( mat4  model,
bool  normal = true 
)

Definition at line 166 of file app.cpp.

void render_teapot ( mat4  model,
bool  normal = true 
)

Definition at line 157 of file app.cpp.

void update_app ( float  dt)

Definition at line 140 of file app.cpp.

Variable Documentation

float aspect_ratio = 1.0f
static

Definition at line 92 of file app.cpp.

Mesh cube

Definition at line 53 of file app.cpp.

float delta_x = 0.0f
static

Definition at line 85 of file app.cpp.

float delta_y = 0.0f
static

Definition at line 86 of file app.cpp.

bool dragging = false
static

Definition at line 318 of file app.cpp.

float fov_y = PI / 4.0f
static

Definition at line 91 of file app.cpp.

float last_x = 0.0f
static

Definition at line 319 of file app.cpp.

float last_y = 0.0f
static

Definition at line 320 of file app.cpp.

vec3 light_color[num_lights]
Initial value:
= {
vec3(0.2, 0.8, 0.9),
vec3(1.0, 0.4, 0.2)
}
Definition: matrix.h:51

Definition at line 60 of file app.cpp.

float light_intensity[num_lights]
Initial value:
= {
0.6f, 0.9f
}

Definition at line 65 of file app.cpp.

vec3 light_pos[num_lights]
Initial value:
= {
vec3(0.0), vec3(0.0)
}
Definition: matrix.h:51

Definition at line 56 of file app.cpp.

float light_radius[num_lights]
Initial value:
= {
0.1f, 0.14f
}

Definition at line 69 of file app.cpp.

mat4 mat_projection

Definition at line 50 of file app.cpp.

mat4 mat_view

Definition at line 50 of file app.cpp.

float model_scale = 0.01f
static

Definition at line 73 of file app.cpp.

const int num_lights = 2

Definition at line 55 of file app.cpp.

Mesh quad

Definition at line 53 of file app.cpp.

float rot_x = -0.5f
static

Definition at line 83 of file app.cpp.

float rot_y = 0.0f
static

Definition at line 84 of file app.cpp.

float s_ambient = 0.20f
static

Definition at line 76 of file app.cpp.

float s_distortion = 0.07f
static

Definition at line 77 of file app.cpp.

float s_scale = 3.50f
static

Definition at line 79 of file app.cpp.

float s_sharpness = 10.0f
static

Definition at line 78 of file app.cpp.

Shader shader_opaque

Definition at line 43 of file app.cpp.

Shader shader_prepass

Definition at line 43 of file app.cpp.

Shader shader_resolve

Definition at line 43 of file app.cpp.

Shader shader_scattering

Definition at line 43 of file app.cpp.

Shader shader_thickness

Definition at line 43 of file app.cpp.

Mesh sphere

Definition at line 53 of file app.cpp.

Mesh teapot

Definition at line 53 of file app.cpp.

int window_height

Definition at line 39 of file app.cpp.

int window_width

Definition at line 39 of file app.cpp.

float z_far = 15.0f
static

Definition at line 90 of file app.cpp.

float z_near = 0.1f
static

Definition at line 89 of file app.cpp.

float zoom = 3.0f
static

Definition at line 82 of file app.cpp.