OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.cpp
Go to the documentation of this file.
1 /* Copyright (c) 2014-2017, ARM Limited and Contributors
2  *
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge,
6  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  */
20 
21 #include "ClipmapApplication.h"
22 #include "EGLRuntime.h"
23 #include "Platform.h"
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 
28 #include <jni.h>
29 #include <android/log.h>
30 
31 using namespace MaliSDK;
32 
33 
34 // Implements a geometry clipmap algorithm.
35 // Paper: http://research.microsoft.com/en-us/um/people/hoppe/geomclipmap.pdf
36 
37 // Sets the size of clipmap blocks, NxN vertices per block. Should be power-of-two and no bigger than 64.
38 // A clipmap-level is organized roughly as 4x4 blocks with some padding. A clipmap level is a (4N-1) * (4N-1) grid.
39 #define CLIPMAP_SIZE 64
40 
41 // Number of LOD levels for clipmap.
42 #define CLIPMAP_LEVELS 10
43 
44 // Distance between vertices.
45 #define CLIPMAP_SCALE 0.25f
46 
49 
50 extern "C"
51 {
53  (JNIEnv *env, jclass jcls, jint width, jint height)
54  {
55  delete app;
59  }
60 
62  (JNIEnv *env, jclass jcls)
63  {
65  }
66 
68  (JNIEnv *, jclass)
69  {
70  delete app;
71  app = NULL;
72  }
73 }
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_terrain_Terrain_step(JNIEnv *env, jclass jcls)
Definition: main.cpp:62
#define CLIPMAP_SCALE
Definition: main.cpp:45
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_terrain_Terrain_uninit(JNIEnv *, jclass)
Definition: main.cpp:68
GLint GLsizei GLsizei height
Definition: gl2ext.h:179
#define CLIPMAP_SIZE
Definition: main.cpp:39
int surface_height
Definition: main.cpp:48
#define CLIPMAP_LEVELS
Definition: main.cpp:42
int surface_width
Definition: main.cpp:48
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_terrain_Terrain_init(JNIEnv *env, jclass jcls, jint width, jint height)
Definition: main.cpp:53
ClipmapApplication * app
Definition: main.cpp:47
GLint GLsizei width
Definition: gl2ext.h:179
void render(unsigned int viewport_width, unsigned int viewport_height)