Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL on Android using C++ only [closed]

I'm developing an Android application for Android 2.1.

I'm trying to code OpenGL's stuff with C++ only.

Do you know a tutorial or an article showing an example about how to do that?

UPDATE:

Sorry, I've forget to say that I will use a Java home application to launch main activity.

I'm trying to say if I have to code on Java glSurfaceView or this statement must be on C++ code.

Ok, better explained: If I have a complete openGl on C++, may I have to modify C++ code?

Thanks.

like image 249
VansFannel Avatar asked Nov 01 '10 17:11

VansFannel


2 Answers

In the Android NDK there is a san-angeles demo under the samples directory which shows off using OpenGL ES 1.x in C code and a Java wrapper. As for changes to already existing C++ code be aware that there is no official STL implementation for the NDK r4 (although I believe there are some ports available) [edit: as of NDK r5 there is a STLport based implementation of STL]. And I'm guessing that you'll need to mimic what the demo does for the GLSurfaceView since outside events (touch, keyboard, etc.) along with the Android activity lifecycle must be to be handled by the Java side. If you are looking for a OpenGL ES 2.0 example, there is a basic one in the samples directory of the Android NDK as well.

like image 191
Morrison Chang Avatar answered Nov 15 '22 12:11

Morrison Chang


According to http://developer.android.com/sdk/ndk you can't do it purely in C++. As you suggest in your update, you'll need to do the application with the standard (Java) SDK, but can create C++ libraries and call into them. With respect to OpenGL, the article suggests that you have full access to OpenGL ES, either 1.1 or 2.0. ES is not the same as the full OpenGL.

like image 43
AustinDahl Avatar answered Nov 15 '22 11:11

AustinDahl