duyna22
#1
Hello,
New bug for today. It’s worked fine on Mac but got error when build Android. More details above:
- Device: Asus zenfone 450a - Android 4.4
- Android build type: cmake
- Android NDK version: R18
- cocos2d-x version: 3.17.1 (last pull from github)
Sources:
HelloWorldScene.cpp (5.1 KB)
HelloWorldScene.h (1.7 KB)
1 Like
I know it’s too late reply,
It’s not render bug. this is floating point precision problem (in shader)
set all fragment shader’s floating point precision to ‘highp’ in opengl es and works fine
Thank for you help!
Can you show me more detail ?
Best regards
I believe. you already know about what is floating point precision. and what fragment shader is
So. Cocos2d-x all fragment shader’s settings about floating-point precision is mediump or lowp when compile android
and I will explain about settings step-by-step.
open ‘ALL’ fragment-shader file like
‘cocos/renderer/ccShader_XXXX.frag’
and
edit below (in top of file)
#ifdef GL_ES
precision lowp float; // or mediump float;
#endif
...
to
#ifdef GL_ES
precision highp float;
#endif
...
some of *.frag files does not include this statement.
if there is no ‘float precision statement’,
no need to edit ‘fragment-shader’ file.
and
open file ‘cocos/renderer/CCGLProgram.cpp’
and go to 491 line (maybe…between 490~495)
edit this line
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
headersDef = "#version 100\n precision lowp float;\n precision lowp int;\n";
to
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
headersDef = "#version 100\n precision highp float;\n precision highp int;\n";
Hope this will helps you.
2 Likes
How a nice guy!!
Thank you!
system
closed
#6
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.