[Cocos2d-x 3.17.1] Render bug when move Node

[Cocos2d-x 3.17.1] Render bug when move Node

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)


HelloWorldScene.cpp (5.1 KB)
HelloWorldScene.h (1.7 KB)


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


edit below (in top of file)

#ifdef GL_ES
precision lowp float; // or mediump float;


#ifdef GL_ES
precision highp float;

some of *.frag files does not include this statement.
if there is no ‘float precision statement’,
no need to edit ‘fragment-shader’ file.


open file ‘cocos/renderer/CCGLProgram.cpp’
and go to 491 line (maybe…between 490~495)
edit this line

        headersDef = "#version 100\n precision lowp float;\n precision lowp int;\n";


        headersDef = "#version 100\n precision highp float;\n precision highp int;\n";

Hope this will helps you.

1 Like

How a nice guy!!
Thank you!

closed #6

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.