Bug #1229

(gles20) android port can not be compiled on ndk android-8 level

Added by Zhe Wang about 1 year ago. Updated about 1 year ago.

Status:Closed Start date:2012-05-05
Priority:Normal Due date:
Assignee:Zhe Wang % Done:

100%

Category:-
Target version:cocos2d-2.0-rc0a-x-2.0

Description

android-3 -> Official Android 1.5 system images
android-4 -> Official Android 1.6 system images
android-5 -> Official Android 2.0 system images
android-6 -> Official Android 2.0.1 system images
android-7 -> Official Android 2.1 system images
android-8 -> Official Android 2.2 system images
android-9 -> Official Android 2.3 system images
android-10 -> Official Android 2.3.3 system images
android-14 -> Official Android 4.0 system images

Currently in gles20 branch's project.porperties, android-10 is required, which means 2.0 games can only run on android 2.3.3 or higher devices.
THIS IS UNACCEPTABLE.

Finally I find that gles20 depends on android-9 and higher, coz CCEGLView includes EGL/egl.h, while android-8 has no EGL headers.
We depends EGL to get only 3 APIs,
  1. glGenVertexArraysOES
  2. glBindVertexArrayOES
  3. glDeleteVertexArraysOES
    In CCGL.h, these 3 APIs are redefined
    #define glDeleteVertexArrays        glDeleteVertexArraysOES
    #define glGenVertexArrays           glGenVertexArraysOES
    #define glBindVertexArray           glBindVertexArrayOES
    

    And finally they are invoked in CCParticleSystemQuad.cpp & CCTextureAtlas.cpp, with a pre-condition that marco CC_TEXTURE_ATLAS_USE_VAO 1
    CC_TEXTURE_ATLAS_USE_VAO marco is defined in ccConfig.h
    #ifndef CC_TEXTURE_ATLAS_USE_VAO
        #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
            #define CC_TEXTURE_ATLAS_USE_VAO 1
        #else
            /* Some android devices cannot support VAO very well, so we disable it by default for android platform. */
            #define CC_TEXTURE_ATLAS_USE_VAO 0
        #endif
    #endif
    

    So it means on android platform CC_TEXTURE_ATLAS_USE_VAO 0, it's disabled.

OK, so if your game is very performance-hungry, you can enable CC_TEXTURE_ATLAS_USE_VAO to run it faster, but your game is limited to android 2.3 and higher devices,
By default, we should disable CC_TEXTURE_ATLAS_USE_VAO to adapt games on wider range.

History

Updated by Zhe Wang about 1 year ago

from http://developer.android.com/resources/tutorials/opengl/opengl-es20.html

Caution: OpenGL ES 2.0 is currently not supported by the Android Emulator. You must have a physical test device running Android 2.2 (API Level 8) or higher in order to run and test the example code in this tutorial.

Updated by Zhe Wang about 1 year ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset commit:435c74e52c5b18ae7e0f6257711e251330362881.

Updated by Minggo Zhang about 1 year ago

OK, so if your game is very performance-hungry, you can enable CC_TEXTURE_ATLAS_USE_VAO to run it faster, but your game is limited to android 2.3 and higher devices,

No, Android can not work correctly if CC_TEXTURE_ATLAS_USE_VAO is set to 1.
It meas, Android dones't support opengl es 20 very well.
You can not use these three opengl es functions on Android.

Updated by Zhe Wang about 1 year ago

  • Status changed from Resolved to Closed

Updated by Zhe Wang about 1 year ago

  • Project changed from cocos2d-x to native
  • Category deleted (2)

Updated by Zhe Wang about 1 year ago

  • Target version deleted (26)

Updated by Zhe Wang about 1 year ago

  • Target version set to cocos2d-2.0-rc0a-x-2.0

Also available in: Atom PDF