What to know about compiling OpenGL applications to android

#1

Ok so, I’m working on my first OpenGL project (in Java). I’m working on it in Linux and Windows, and the program works just fine. But if I want to make it android-compatible to, what do I need to change in my code? Are the android methods same as the desktop methods? Do I need to compile everything from zero, because I need to use another different library? I’m using Lightweight Java Game Library (lwjgl) right now, but I heard that Vulkan supports multi-platform and there is Opengl ES, wich is meant for android. Can I code a desktop and android game with Opengl ES, without losing performance or something? I really have no clue about how the standard opengl library works on andropid, and what I need to do to make it work on there.

#2

Android graphics drivers provide support for OpenGL ES, rather than OpenGL. OpenGL ES is for embedded systems. The interfaces are very similar. In fact, many of the APIs are the same. OpenGL ES 2.x+ just doesn’t have a lot of the old, legacy OpenGL APIs that are accessible in the OpenGL compatibility profile.

Also, the windowing system layer is different. Instead of using GLX (on Linux) or WGL (on Windows), you use EGL. Its pretty similar however, and using it is fairly straightforward.

Now adapting your desktop GPU code to work well with mobile GPUs is a bigger hurdle. Though OpenGL and OpenGL ES are very similar in interface, the implementation is very different as you transition from a desktop GPU to a mobile GPU. With mobile, you need to know more of what’s going on under-the-covers to make efficient use of the GPU than you do on desktop. If you develop to perform well on a mobile, your app will generally perform very well on desktop, but not the reverse.

Yes. There are several options for compiling and running OpenGL ES-based applications on desktop, including NVidia GL drivers (on Linux at least), ANGLE, Mesa3D. and OpenGL ES implementations offered by mobile GPU vendors (e.g. PowerVR, Adreno, etc.).

Possibly. But that depends on a number of things. What GPU capabilities you make use of and what the platform(s) involved provide, as well as how well you understand how to develop efficiently for mobile GPUs.

Just do a little websearching on OpenGL ES with Android. You’ll get some good hits from the GPU vendors that support OpenGL ES in their drivers, as well as Google.