OpenGL on Android using C++ only [closed]

人走茶凉 提交于 2019-12-09 06:03:52

问题


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.


回答1:


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.




回答2:


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.




回答3:


Try Arm Developer Center link. It has native tutorials on basics of an OpenGL ES application.



来源:https://stackoverflow.com/questions/4071495/opengl-on-android-using-c-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!