Home » Android » Android – tutorials for OpenGL ES 2.0 using the NDK?

Android – tutorials for OpenGL ES 2.0 using the NDK?

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m looking to learn OpenGL ES 2.0 on Android and the tutorials I’ve found are nearly all for using the SDK with Java. I want to use native code however so I want to do it through the NDK.
The only tutorial/example I’ve found is the sample-stuff in the NDK itself.

Where can I find some NDK OpenGL ES 2.0 tutorials?
If there are no good tutorials out there, is it possible to use the Java OpenGL tutorials to learn how to use it in the NDK as well? For example do the methods map 1:1 from java to native?

How to&Answers:

I’ve created an example on how to combine UI done in Java with native NDK code that does all the OpenGL rendering. It is possible to do without resorting to GLSurfaceView and JNI calls for rendering each frame like done in the NDK sample.

See the code at https://github.com/tsaarni/android-native-egl-example

Answer:

Check this link. It concerns NDK and OpenGL issues, as well as several other related to game engine programming and more. I find it very interesting and helpful.

Answer:

Google has a sample project on GitHub which demonstrates how to setup a EGL context from native code, using SurfaceView created in Java: Teapots sample. In particular, take a look at “more teapots” app and code in ndk_helper for context creation.

If you want to work without any Java code, then this sample should help you get started: native activity

Edit: additionally, this link gives a higher level overview of relationship between Java Surface, it’s native counterpart and EGL: EGLSurfaces and OpenGL ES