Install Opengl Es And Compile Code For Android
Solution 1:
Those libraries are provided by Android itself. However, setting up your project to find them and compile your JNI (native) code correctly can be daunting.
I recommend using glbuffer as a starting project, as it will provide you with a GLSurfaceView
to draw on and set you up with the proper Android libraries.
The details of linking to the Android libraries are contained in jni/Android.mk
inside that project if you'd like to give it a shot yourself from scratch.
Edit - apparently glbuffer is missing jni/Application.mk
. Create it and put this inside:
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-8
Then the ndk will know to look inside the android-8 platform for your includes. You can change this to other versions as needed.
Solution 2:
I searched the NDK for instances of the "EGL/egl.h" header file. This particular example will compile and run on Android API level 15, but some other API levels don't have the header.
Solution 3:
I just added
#include<jni.h>
to cube.c & cuberenderer.c
Changed
(*g_VM)->AttachCurrentThread (g_VM, (void **) &env, NULL);
to
(*g_VM)->AttachCurrentThread (g_VM, (conststruct JNINativeInterface ***) &env, NULL);
My Android.mk:
LOCAL_PATH:= $(call my-dir)include$(CLEAR_VARS)
LOCAL_MODULE := libgltest_jni
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := cube.c cuberenderer.c
LOCAL_LDLIBS := -llog
-lGLESv1_CM
include$(BUILD_SHARED_LIBRARY)
My Application.mk:
# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-9
And built it on android-ndk-r6
Solution 4:
You used the filename GLES/glext.h twice.
Post a Comment for "Install Opengl Es And Compile Code For Android"