VR SDK for Android 0.1.1 ARM Developer Center
armvr.h File Reference
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <GLES3/gl3.h>
#include <stdlib.h>
#include <string.h>
#include <matrix.h>
#include <iostream>
#include <android/log.h>

Go to the source code of this file.

Classes

struct  Framebuffer
 
struct  DistortionCoefficients
 
struct  LensConfig
 
struct  HMDConfig
 
struct  WarpMesh
 
struct  App
 

Macros

#define Meter(x)   (x)
 
#define Centimeter(x)   (Meter(x) / 100.0f)
 
#define Millimeter(x)   (Meter(x) / 1000.0f)
 
#define Num_Eyes   2
 
#define Num_Views   Num_Eyes * 2
 
#define Screen_Resolution_X   2560
 
#define Screen_Resolution_Y   1440
 
#define Screen_Size_X   Meter(0.125f)
 
#define Screen_Size_Y   Meter(0.072f)
 
#define Eye_Fb_Resolution_X   1280
 
#define Eye_Fb_Resolution_Y   1440
 
#define Multisample_Samples   4
 
#define Eye_IPD   Millimeter(61.0f)
 
#define Lens_IPD   Millimeter(64.0f)
 
#define Eye_Display_Distance   Centimeter(8.0f)
 
#define GL_TEXTURE_BORDER_COLOR_EXT   0x1004
 
#define GL_CLAMP_TO_BORDER_EXT   0x812D
 
#define LOG_TAG   "ARMVR"
 
#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 LOGD(...)   __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
 
#define GL_CHECK(x)
 
#define get_attrib_location(prog, name)
 
#define get_uniform_location(prog, name)
 
#define attribfv(prog, name, n, stride, offset)
 
#define attribiv(prog, name, n, stride, offset)
 
#define uniform1f(prog, name, value)   GL_CHECK(glUniform1f(app->u_##prog##_##name, value));
 
#define uniform2f(prog, name, x, y)    GL_CHECK(glUniform2f(app->u_##prog##_##name, x, y));
 
#define uniform2fv(prog, name, value)   GL_CHECK(glUniform2fv(app->u_##prog##_##name, 1, &value[0]));
 
#define uniform3fv(prog, name, value)   GL_CHECK(glUniform3fv(app->u_##prog##_##name, 1, &value[0]));
 
#define uniform1i(prog, name, value)   GL_CHECK(glUniform1i(app->u_##prog##_##name, value));
 
#define uniformm4(prog, name, value)   GL_CHECK(glUniformMatrix4fv(app->u_##prog##_##name, 1, GL_FALSE, value.value_ptr()));
 
#define uniformm4array(prog, name, value, arraySize)   GL_CHECK(glUniformMatrix4fv(app->u_##prog##_##name, arraySize, GL_FALSE, value.value_ptr()));
 

Functions

void gl_check (const char *msg)
 
void app_initialize (App *app)
 
void app_update_and_render (App *app)
 

Macro Definition Documentation

#define attribfv (   prog,
  name,
  n,
  stride,
  offset 
)
Value:
GL_CHECK(glEnableVertexAttribArray(app->a_##prog##_##name)); \
GL_CHECK(glVertexAttribPointer(app->a_##prog##_##name, n, GL_FLOAT, GL_FALSE, \
stride * sizeof(GLfloat), (void*)(offset * sizeof(GLfloat))));
#define GL_CHECK(x)
Definition: armvr.h:184
static App app
Definition: main.cpp:30

Definition at line 203 of file armvr.h.

#define attribiv (   prog,
  name,
  n,
  stride,
  offset 
)
Value:
GL_CHECK(glEnableVertexAttribArray(app->a_##prog##_##name)); \
GL_CHECK(glVertexAttribPointer(app->a_##prog##_##name, n, GL_INT, GL_FALSE, \
stride * sizeof(GLint), (void*)(offset * sizeof(GLint)) ));
#define GL_CHECK(x)
Definition: armvr.h:184
static App app
Definition: main.cpp:30
typedef GLint
Definition: armvr.cpp:53

Definition at line 207 of file armvr.h.

#define Centimeter (   x)    (Meter(x) / 100.0f)

Definition at line 32 of file armvr.h.

#define Eye_Display_Distance   Centimeter(8.0f)

Definition at line 74 of file armvr.h.

#define Eye_Fb_Resolution_X   1280

Definition at line 54 of file armvr.h.

#define Eye_Fb_Resolution_Y   1440

Definition at line 55 of file armvr.h.

#define Eye_IPD   Millimeter(61.0f)

Definition at line 66 of file armvr.h.

#define get_attrib_location (   prog,
  name 
)
Value:
app->a_##prog##_##name = GL_CHECK(glGetAttribLocation(app->program_##prog, #name)); \
if (app->a_##prog##_##name < 0) { \
LOGE("Invalid or unused attribute %s\n", #name); \
}
#define GL_CHECK(x)
Definition: armvr.h:184
static App app
Definition: main.cpp:30

Definition at line 193 of file armvr.h.

#define get_uniform_location (   prog,
  name 
)
Value:
app->u_##prog##_##name = GL_CHECK(glGetUniformLocation(app->program_##prog, #name)); \
if (app->u_##prog##_##name < 0) { \
LOGE("Invalid or unused uniform %s\n", #name); \
}
#define GL_CHECK(x)
Definition: armvr.h:184
static App app
Definition: main.cpp:30

Definition at line 198 of file armvr.h.

#define GL_CHECK (   x)
Value:
x; \
{ \
GLenum glError = glGetError(); \
if(glError != GL_NO_ERROR) { \
LOGE("glGetError() = %i (0x%.8x) at %s:%i\n", glError, glError, __FILE__, __LINE__); \
exit(1); \
} \
}

Definition at line 184 of file armvr.h.

#define GL_CLAMP_TO_BORDER_EXT   0x812D

Definition at line 82 of file armvr.h.

#define GL_TEXTURE_BORDER_COLOR_EXT   0x1004

Definition at line 78 of file armvr.h.

#define Lens_IPD   Millimeter(64.0f)

Definition at line 70 of file armvr.h.

#define LOG_TAG   "ARMVR"

Definition at line 86 of file armvr.h.

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

Definition at line 89 of file armvr.h.

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

Definition at line 88 of file armvr.h.

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

Definition at line 87 of file armvr.h.

#define Meter (   x)    (x)

Definition at line 31 of file armvr.h.

#define Millimeter (   x)    (Meter(x) / 1000.0f)

Definition at line 33 of file armvr.h.

#define Multisample_Samples   4

Definition at line 59 of file armvr.h.

#define Num_Eyes   2

Definition at line 41 of file armvr.h.

#define Num_Views   Num_Eyes * 2

Definition at line 42 of file armvr.h.

#define Screen_Resolution_X   2560

Definition at line 45 of file armvr.h.

#define Screen_Resolution_Y   1440

Definition at line 46 of file armvr.h.

#define Screen_Size_X   Meter(0.125f)

Definition at line 47 of file armvr.h.

#define Screen_Size_Y   Meter(0.072f)

Definition at line 48 of file armvr.h.

#define uniform1f (   prog,
  name,
  value 
)    GL_CHECK(glUniform1f(app->u_##prog##_##name, value));

Definition at line 211 of file armvr.h.

#define uniform1i (   prog,
  name,
  value 
)    GL_CHECK(glUniform1i(app->u_##prog##_##name, value));

Definition at line 215 of file armvr.h.

#define uniform2f (   prog,
  name,
  x,
 
)    GL_CHECK(glUniform2f(app->u_##prog##_##name, x, y));

Definition at line 212 of file armvr.h.

#define uniform2fv (   prog,
  name,
  value 
)    GL_CHECK(glUniform2fv(app->u_##prog##_##name, 1, &value[0]));

Definition at line 213 of file armvr.h.

#define uniform3fv (   prog,
  name,
  value 
)    GL_CHECK(glUniform3fv(app->u_##prog##_##name, 1, &value[0]));

Definition at line 214 of file armvr.h.

#define uniformm4 (   prog,
  name,
  value 
)    GL_CHECK(glUniformMatrix4fv(app->u_##prog##_##name, 1, GL_FALSE, value.value_ptr()));

Definition at line 216 of file armvr.h.

#define uniformm4array (   prog,
  name,
  value,
  arraySize 
)    GL_CHECK(glUniformMatrix4fv(app->u_##prog##_##name, arraySize, GL_FALSE, value.value_ptr()));

Definition at line 217 of file armvr.h.

Function Documentation

void app_initialize ( App app)

Definition at line 294 of file armvr.cpp.

void app_update_and_render ( App app)

Definition at line 424 of file armvr.cpp.

void gl_check ( const char *  msg)