Other code is not important, but C code is important.
Nativerenderer. cpp
# Include <JNI. h> <br/> # include <Android/log. h> <br/> # include <gles2/gl2.h> <br/> # include <gles2/gl2ext. h> <br/> # include <gles/GL. h> <br/> # include <stdio. h> <br/> # include <stdlib. h> <br/> # include <math. h> <br/> const glfloat gtrianglevertices [] ={< br/>-0.5f,-0.5f, 0.5f, <br/> 0.5f,-0.5f, 0.5f, <br/> 0.0f,-0.5f, 1.0f, <br/> 0.0f, 0.0f, 0.5f, <br/> }; <br/> const glfloat _ colorarray [] ={< br/> 1.0f, 0.0f, 0.0f, 1.0f, <br/> 0.0f, 1.0f, 0.0f, 1.0f, <br/> 0.0f, 0.0f, 1.0f, 1.0f, <br/> 1.0f, 1.0f, 1.0f, 1.0f, <br/> }; <br/> const glbyte _ indexarray [] = {<br/>, 3, <br/>, 1, <br/>, 2, <br/> 1, 2, 3, <br/>}; <br/> glfloat _ xangle = 0.0f; <br/> glfloat _ yangle = 0.0f; <br/> extern "C" {<br/> jniexport void jnicall encode (jnienv * ENV, jobject OBJ); <br/> jniexport void jnicall encode (jnienv * ENV, jobject OBJ, jint width, jint height); <br/> jniexport void jnicall inline (jnienv * ENV, jobject OBJ); <br/> jniexport void jnicall inline (jnienv * ENV, jobject OBJ, jfloat X, jfloat y); <br/>}; <br/> jniexport void jnicall encode (jnienv * ENV, jobject OBJ) {</P> <p >}< br/> jniexport void jnicall java_com_geolo_android_myrenderer_nativesurfacechanged (jnienv * ENV, jobject OBJ, jint W, jint H) {<br/>}< br/> jniexport void jnicall encode (jnienv * ENV, jobject OBJ) {<br/> glclearcolor (0.0f, 0.0f, 0.0f, 1.0f ); <br/> // glclear (gl_depth_buffer_bit | gl_color_buffer_bit); <br/> // glvertexattribpointer (3, 2, gl_float, gl_false, 0, gtrianglevertices ); <br/> // glcolorattribpointer (4, gl_float, 0, _ colorarray); <br/> // gldrawarrays (gl_triangles, 0, 3 ); <br/> glclear (gl_color_buffer_bit); <br/> // glloadidentity (); <br/> glrotatef (_ xangle, 0.5f, 0.0f, 0.0f ); <br/> glrotatef (_ yangle, 0.0f, 0.5f, 0.0f); <br/> // vertex <br/> glvertexpointer (3, gl_float, 0, gtrianglevertices ); <br/> // vertex color <br/> glcolorpointer (4, gl_float, 0, _ colorarray); <br/> gldrawelements (gl_triangles, 12, gl_unsigned_byte, _ indexarray ); <br/>}< br/> jniexport void jnicall encode (jnienv * ENV, jobject OBJ, jfloat X, jfloat y) {<br/> _ xangle = X; <br/> _ yangle = y; <br/>}< br/>
The second important part is: Android. mk
# Copyright (c) 2009 the android open source project <br/> # licensed under the Apache license, version 2.0 (the "License "); <br/> # You may not use this file except T in compliance with the license. <br/> # You may obtain a copy of the license at <br/> # http://www.apache.org/licenses/LICENSE-2.0 <br/> # unless required by applicable law or agreed to in writing, software <br/> # distributed under the license is distributed on an "as is" basis, <br/> # Without warranties or conditions of any kind, either express or implied. <br/> # See the license for the specific language governing permissions and <br/> # limitations under the license. <br/> # <br/> local_path: = $ (call my-DIR) <br/> include $ (clear_vars) <br/> local_module: = geolo3d <br/> local_cflags: =-werror <br/> local_src_files: = nativerenderer. CPP <br/> local_ldlibs: =-llog-lglesv2-lglesv1_cm-LDL <br/> include $ (build_shared_library)
The important part of Android. mk is: local_ldlibs: =-llog-lglesv2-lglesv1_cm-LDL.
For example, without-LDL, you cannot call glvertexpointer (3, gl_float, 0, gtrianglevertices) in C/C ++; and
Glcolorpointer (4, gl_float, 0, _ colorarray );
-LDL is a function library, I do not have this document, if the buddy has these documents, please send me, geolo@vip.qq.com. Thank you...