Projects > cpp > Issues > Bug #1229

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

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

Bug #1229 [Closed]
walzer@cocos2d-x.org 2012-05-05 01:53 . Updated over 12 years ago

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,
# glGenVertexArraysOES
# glBindVertexArrayOES
# 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
<pre>
#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
</pre>
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.

walzer@cocos2d-x.org 2012-05-05 02:05

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.

walzer@cocos2d-x.org 2012-05-05 02:25
  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset commit:435c74e52c5b18ae7e0f6257711e251330362881.

zhangxm 2012-05-07 09:10

>> 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.

walzer@cocos2d-x.org 2012-05-08 05:49
  • Status changed from Resolved to Closed
walzer@cocos2d-x.org 2012-05-25 07:57
  • Project changed from cocos2d-x to cpp
  • Category deleted (2)
walzer@cocos2d-x.org 2012-05-25 07:58
  • Target version deleted (26)
walzer@cocos2d-x.org 2012-05-25 09:25
  • Target version set to cocos2d-2.0-rc0a-x-2.0

Atom PDF

Status:Closed
Start date:2012-05-05
Priority:Normal
Due date:
Assignee:walzer@cocos2d-x.org
% Done:

100%

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