android_rust_gl
android_rust_gl copied to clipboard
minimal rust openGLES/shader sample running on android, should also build& run on linux desktop
Minimal Rust Android OpenGL ES sample
Displays spinning tori in a lisajous curve; derived from NDK "native-activity" sample. creates an opengl 2 context. Uses a C stub, which calls rust_android_init .. rust_android_render; these are #[no_mangle] extern "C" functions defined in main.rs, its just a quick sample, and pretty messy, but minimal.
To run: cd android [1] android update project --target "android-19" --name NativeActivity --subprojects --path . [2] make
.. that should compile and deploy the project. make in the project root should run the same rendering code on desktop.
android/jni/desktop_emu_gl.c provides empty stub functions for linking.
the C mainloop in jni/main.c calls Rust entrypoints: main.rs app_create() app_display_create() app_render() app_display_destroy() app_destroy()
'shadertest.rs' implements a 'Screen' trait with update/render functions called by these.