osgearth-android fatal error about "GLES2/gl2.h"

classic Classic list List threaded Threaded
4 messages Options
JimmyXu JimmyXu
Reply | Threaded
Open this post in threaded view
|

osgearth-android fatal error about "GLES2/gl2.h"

Hi,

When I build osgearth-android project by thahemp (https://github.com/thahemp/osgearth-android.git) on ubuntu, I get  "../osg-android/include/osg/GL:37:32 fatal error GLES2/gl2.h: No such file or directory" error. But when I build osg, there is no such error.

I found there is a macro OPENGL_INCLUDE_DIR used in CMAKE_LISTS.txt of osg-android project. And I set it to "${ANDROID_NDK}/platforms/android-14/arch-arm/usr/include" in which GLES2 directory exsits and rebuild osg and osgearth. But error still exsits.

What am I doing wrong?

Regards .
thahemp thahemp
Reply | Threaded
Open this post in threaded view
|

Re: osgearth-android fatal error about "GLES2/gl2.h"

Does this error come after armeabi and armeabi-v7a finish compiling? I do seem to remember the build environment attempts to keep building architectures after the Android build completes. When it moves on to x86 it fails with that error. I ran out of time to work on the build environment and left it as is because it successfully builds the binaries I needed.

Check your build/obj/local/armeabi* directories for static libraries. They should be fine if they were built.

Just a heads up. libpng will need to be upgraded if you ever plan on submitting your project to the play store. libpng 1.4.3 is what is in the repo and it is flagged as a vulnerability by the play store. I upgraded to libpng 1.6.29 to fix the issue.
JimmyXu JimmyXu
Reply | Threaded
Open this post in threaded view
|

Re: osgearth-android fatal error about "GLES2/gl2.h"

It's inspiring to get a reply from you, the original contributor. I ignored that error and finally found the static libraries were built successfully.  

After that I built the osgEarthAndroidDemo and got a new "libosgNativeLib.so: text relocations" error at the startup. I ingored it and the earth with the atmosphere and starry sky is shown.


But when I switch the APP to background and switch it back, the APP seems to be crashed and restarted. And then the atmosphere and starry sky disappear.


As for the "text relocations" error, I checked every OSG/osgEarth and third party library that libosgNativeLib.so depends on with "readelf -a path/to/yourlib.so | grep TEXTREL" command, none of them has "text relocations" error.

I add up a "LOCAL_LDFLAGS += -fPIC" option to the Android.mk file in the "Map/app/src/osgearth/jni" directory  and rebuild it, the newly generated libosgNativeLib.so still has the "text relocations" error.


I build OSG and osgEarth with NDK r8b and osgEarthAndroidDemo with android studio 3.1.1, targetSdkVersion 20 and JRE1.8.0. And My device is Xiaomi 5 with snapdragon 820 CPU.

Do you have any idea about these two problems?

Thanks.
thahemp thahemp
Reply | Threaded
Open this post in threaded view
|

Re: osgearth-android fatal error about "GLES2/gl2.h"

I am not familiar with the text relocations error.

As far as EGLView lifecycle issues go, Android is a little bit weird to deal with. The link between your scene and the EGLView is shaky at best when focus is lost. I destroy my scene when EGLView onPause is called, then recreate in the Renderer onSurfaceChanged method. I don't remember how much detail is actually in the demo app. Probably not much.