I want to compile an Android OpenGL console application that you can run directly from console boot Android x86, or from the Android terminal application inside Android x86 GUI.
This post ( How can I create a new NativeWindow in Android NDK? ) asks a similar question. However, the answer says to download and build the entire android source code because the tests here ( https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests ) such as ( https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests/gl_basic/gl_basic.cpp ) have dependencies such as "#include "
I want to build the application ideally with the NDK, but if necessary I could build it on Ubuntu.
gl_basic.cpp would be great, except I don't want to have to download and build the entire Android source code just to build such a tiny program (gl_basic.cpp is only 364 lines of code!)
I tried to build gl_basic.cpp with ndk-build.cmd, but I get FramebufferNativeWindow.h not found... And then if I keep downloading more header files to my local project, I eventually run into link errors. I wonder if there is an easier way to build something like gl_basic.cpp (Android OpenGL executable with a main() function) using the NDK.
PS I know the normal way to write Android apps is to create an APK, but I don't want to do that - I want a stand-alone Linux executable with main() and OpenGL that I can run from the Android Terminal Emulator application that runs inside Android... On x86 based Android (not ARM).
Also let me add that I know you can put "include $(BUILD_EXECUTABLE)" in the Android.mk file and "APP_ABI := x86" in the Application.mk file. I have no problem building an Android executable with ndk-build.cmd that runs from Android Terminal Emulator on x86 Android and prints "hello world" with printf().
The thing I have a problem with is creating such an executable with OpenGL. I think part of the magic is FramebufferNativeWindow.h, but that has its own includes too... I'm wondering if I can build something similar to gl_basic.cpp with ndk-build.cmd (or even with make and gcc on Ubuntu) that will run in Android Terminal Emulator... But I don't want to have to download and build the entire Android source tree.
Summary: how do I create a native window with headers and libraries that are included in the NDK? I know it can be done by calling android_createDisplaySurface() from libui. However, libui is not included as part of the NDK. So how can I create a native window (for use by EGL and OpenGL) from the NDK with pure C++ (no Java) code? eglCreateWindowSurface()'s 3rd arg is NativeWindowType, so I need to create a NativeWindow somehow.
Summary: My ultimate goal is to write a C++ executable with a main() function that draws an OpenGL triangle, that I can run on Android x86 console mode. No Java.