Android + NDK + CDT + eclipse + OPenGL ES compilation and native debugging, androidndk

Source: Internet
Author: User
Tags macbook

Android + NDK + CDT + eclipse + OPenGL ES compilation and native debugging, androidndk

Environment:

NDK version r8, eclipse and Android is the adt-bundle-windows-x86 package version is more convenient,

I. NDK Compilation

1. Source Code

NDK examples directory has the source code of the Hello-GL2, you can use it first.

2. Import the sample project to eclipse

3. Compilation settings

A. Select a project. Choose windows> prefereces> android> NDK in eclipse.

Set the NDK path

B. Select a project. Choose project> properties in eclipse.

Click builder and select CDT Builder

Click c/c ++ Bulder, in Builder setting, set build command to ndk-build NDK_DEBUG = 1 V = 1 (NDK_DEBUG = 1 V = 1 is mainly used to prepare for native debugging)

C. run the project.



2. native debugging

1. Create a simulator

The Simulator version should not be too high. My version is android2.3.3; otherwise, debugging may fail.


2. Select a project, right-click the pop-up menu, and click native support

3. Select a project, right-click the pop-up menu, click Run as android applicaton, and first install the program

4. Select a project, right-click the pop-up menu, and click debug as native applicaton


4. You can debug the c ++ code.

Note:

1. The real machine may encounter the no debug symbol found error.

2. If the Simulator version is too high, the error "no debug symbol found" may also occur.

3. Place the downloaded sdks of other versions in \ sdk \ platforms.

4. run as android application first to install the app

Error Type:

The error type occurs because the android version is too high.

1. no debugging symbols found

2. No symbol table is loaded. Use the "file" command

3. Error accessing memory address 0x1a66: Input/output error, etc.





How to Learn about Android opengl es 20? How can I use this game?

OpenGLES is a thing that makes people crash. It is also necessary to make 3D on the Android mobile phone. Share some of my notes here:

About Android OpenGL ES 20011-6-3
Android uses OpenGL standard interfaces to support 3D graphics. android 3D graphics systems are also divided into java framework and local code.
The local code mainly implements the OpenGL interface library. At the Java framework layer, javax. microedition. khronos. opengles is a java standard OpenGL package,
The android. opengl package provides links between the OpenGL System and the Android GUI system.
The local Android code is located in frameworks/base/opengl,
The JNI code is located in frameworks/base/core/com_google_android_gles_jni_GLImpl.cpp and frameworks/base/core/com_google_android_gles_jni_EGLImpl.cpp,
The java class is located under opengl/java/javax/microedition/khronos
The local test code is in frameworks/base/opengl/tests. 14 test codes, including angeles and fillrate, can be called locally through a terminal (adb shell is used in the simulator ).
OpenGL ES 1.x
Fixed pipeline operations. glVertexPointer () and other functions are supported, but GLSL is not supported. The header file is in the GLES directory of ndk, and the library file is libGLESv1_CM.so.
OpenGL ES 2.x
Programmable pipeline operations are not compatible with 1.x. fixed pipeline operations are not supported, such as glVertexPointer () and other functions. Supports GLSL (this is also required for programming ). The header file is in the GLES2 directory of the ndk, and the library file is libGLESv2.so.

OpenGL ES Learning
OpenGL defines its own data types. We should always use these OpenGL data types to ensure portability and efficiency.
OpenGL ES currently does not support 64-bit data types.
OpenGL ES only supports the triagon.
OpenGL ES only supports functions starting with gl.
Functions of OpenGL ES deleted from OpenGL:
1. glBegin/glEnd
2. glArrayElement
3. display the list
4. Calculator
5. index color mode
6. Custom cropping plane
7. glRect
8. Image Processing (this is not a general graphics card, either FireGL or Quadro)
9. Feedback Buffer
10. SELECT Buffer
11. Cumulative Buffer
12. Border flag
13. glPolygonMode
14. GL_QUADS, GL_QUAD_STRIP, GL_POLYGON
15. glPushAttrib, glPopAttrib, glPushClientAttrib, glPopClientAttrib
16. TEXTURE_1D, TEXTURE_3D, TEXTURE_RECT, TEXTURE_CUBE_MAP
17. GL_COMBINE
18. Automatic texture coordinate generation
19. Texture Boundary
20. GL_CLAMP, GL_CLAMP_TO_BORDER
21. deprecated texture Representation
22. Texture levels
23. Texture preferences
24. Automatic texture compression and decompression
25 ...... the remaining full text>

How to install CDT for android configuration cocos2d-x environment?

Create an Android project named "CCTest". Youngs-MacBook-Air :~ Young40 $ cd/opt/cocos2d-2.0-x-2.0.3/Youngs-MacBook-Air: cocos2d-2.0-x-2.0.3 young40 $. create-android-project.sh use global definition of NDK_ROOT:/opt/android-ndk-r8b use global definition of ANDROID_SDK_ROOT:/opt/android-sdk-macosx Input package path. for example: org. cocos2dx. example com. young40 Now cocos2d-x supports Android 2.2 or upper version Available Android targets: ---------- id: 1 or "android-3" Name: Android 1.5 Type: Platform API level: 3 Revision: 4 Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P ABIs: armeabi ---------- id: 2 or "android-10" Name: Android 2.3.3 Type: Platform API level: 10 Revision: 2 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854 ABIs: armeabi ---------- id: 3 or "android-15" Name: Android 4.0.3 Type: Platform API level: 15 Revision: 3 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800 ABIs: armeabi-v7a, x86 ---------- id: 4 or "android-16" Name: Android 4.1 Type: Platform API level: 16 Revision: 2 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in ABIs: armeabi-v7a input target id: 2 input your project name: CCTest Created project directory:/opt/cocos2d-2.0-x-2.0.3/CCTest/proj. android Created directories/opt/cocos2d-2.0-x-2.0.3/CCTest/proj. android/src & #47 ...... remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.