Game Development Reference
In-Depth Information
Figure 5-5. GL native cubes sample file layout
Native Interface Class
The native interface class defines native methods to be invoked within the application thread (see
Listing 5-8). It includes one native method and two callbacks:
static native int NativeRender() : This is the actual native method that will
render the cube. It is implemented natively in C and executed through JNI.
static void OnMessage(String text) : This is a callback invoked within the native
layer to display a message back to the application.
static void GLSwapBuffers() : This is a callback invoked within the native layer to
request a buffer swap (render it). For this sample, this method will not be actually
invoked (as the loop is defined in Java), but it could be useful in other situations
(when the main loop is implemented natively).
Search WWH ::




Custom Search