25 #include <android/log.h>
26 #define LOG_TAG "ProceduralGeometry"
27 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
28 #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
29 #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
31 #define GL_GLEXT_PROTOTYPES
32 #define GL_GEOMETRY_SHADER GL_GEOMETRY_SHADER_EXT
33 #include <GLES3/gl3.h>
34 #include <GLES3/gl31.h>
35 #include <GLES2/gl2ext.h>
38 #define BASE_ASSET_PATH "/data/data/com.arm.malideveloper.openglessdk.proceduralgeometry/files/"
39 #define TEXTURE_PATH(name) BASE_ASSET_PATH name
40 #define SHADER_PATH(name) BASE_ASSET_PATH name
51 case 0:
return "NO_ERROR";
52 case 0x0500:
return "INVALID_ENUM";
53 case 0x0501:
return "INVALID_VALUE";
54 case 0x0502:
return "INVALID_OPERATION";
55 case 0x0503:
return "STACK_OVERFLOW";
56 case 0x0504:
return "STACK_UNDERFLOW";
57 case 0x0505:
return "OUT_OF_MEMORY";
58 case 0x0506:
return "INVALID_FRAMEBUFFER_OPERATION";
59 default:
return "UNKNOWN";
65 GLenum error = glGetError();
66 if (error != GL_NO_ERROR)
82 LOGD(
"Load assets\n");
92 glViewport(0, 0, width, height);
93 LOGD(
"Resizing %d %d\n", width, height);
99 gettimeofday(&now, NULL);
100 float seconds = (now.tv_sec -
start_time.tv_sec);
101 float milliseconds = (
float(now.tv_usec -
start_time.tv_usec)) / 1000000.0
f;
102 float elapsed_time = seconds + milliseconds;
void load_assets(App *app)
void app_update_and_render(App *app)
void app_initialize(App *app)
GLint GLsizei GLsizei height
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_proceduralgeometry_ProceduralGeometry_resize(JNIEnv *env, jobject obj, jint width, jint height)
static timeval start_time
const char * get_gl_error_msg(GLenum code)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_proceduralgeometry_ProceduralGeometry_step(JNIEnv *env, jobject obj)
GLint GLint GLint GLint GLint x
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_proceduralgeometry_ProceduralGeometry_init(JNIEnv *env, jobject obj)
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_proceduralgeometry_ProceduralGeometry_onpointerdown(JNIEnv *env, jobject obj, jfloat x, jfloat y)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_proceduralgeometry_ProceduralGeometry_onpointerup(JNIEnv *env, jobject obj, jfloat x, jfloat y)