30 #include <GLES3/gl3.h>
31 #define GL_GLEXT_PROTOTYPES
32 #include <GLES2/gl2ext.h>
33 #define GL_PATCHES GL_PATCHES_EXT
34 #define GL_PATCH_VERTICES GL_PATCH_VERTICES_EXT
35 #define GL_TESS_CONTROL_SHADER GL_TESS_CONTROL_SHADER_EXT
36 #define GL_TESS_EVALUATION_SHADER GL_TESS_EVALUATION_SHADER_EXT
37 #define glPatchParameteri glPatchParameteriEXT
41 #include <android/log.h>
46 using namespace MaliSDK;
48 #define BASE_ASSET_PATH "/data/data/com.arm.malideveloper.openglessdk.tessellation/files/"
49 #define HEIGHTMAP_PATH(name) BASE_ASSET_PATH name "_heightmap.png"
50 #define DIFFUSEMAP_PATH(name) BASE_ASSET_PATH name "_diffusemap.png"
51 #define SHADER_PATH(name) BASE_ASSET_PATH name
61 case 0:
return "NO_ERROR";
62 case 0x0500:
return "INVALID_ENUM";
63 case 0x0501:
return "INVALID_VALUE";
64 case 0x0502:
return "INVALID_OPERATION";
65 case 0x0503:
return "STACK_OVERFLOW";
66 case 0x0504:
return "STACK_UNDERFLOW";
67 case 0x0505:
return "OUT_OF_MEMORY";
68 case 0x0506:
return "INVALID_FRAMEBUFFER_OPERATION";
69 default:
return "UNKNOWN";
75 GLenum error = glGetError();
76 if (error != GL_NO_ERROR)
86 (JNIEnv *env, jclass jcls)
92 LOGD(
"Loading assets");
95 LOGD(
"App successfully initialized");
103 glViewport(0, 0, width, height);
104 LOGD(
"Resizing %d %d\n", width, height);
108 (JNIEnv *env, jclass jcls)
111 gettimeofday(&now, NULL);
112 float seconds = (now.tv_sec -
start_time.tv_sec);
113 float milliseconds = (
float(now.tv_usec -
start_time.tv_usec)) / 1000000.0
f;
114 app.elapsed_time = seconds + milliseconds;
116 glClearColor(1.0
f, 0.3
f, 0.0
f, 1.0
f);
117 glClear(GL_COLOR_BUFFER_BIT);
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_tessellation_NativeLibrary_init(JNIEnv *env, jclass jcls)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_tessellation_NativeLibrary_resize(JNIEnv *env, jclass jcls, jint width, jint height)
static timeval start_time
const char * get_gl_error_msg(GLenum code)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_tessellation_NativeLibrary_step(JNIEnv *env, jclass jcls)
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)