How to draw anti-aliased line in cocos2d-x for android games?


#1

The problem is as what i ask above.In general we can use:glEnable(GL_LINE_SMOOTH);But this method is not supported in opengles.So we can’t use it for android games. is there a good way to draw a anti-aliased line for android games in cocos2d-x?Any help is very appreciated.
I’m using cocos2d-x 2.0.3.


Final topic about Anti-Aliasing disease
#2

I have tested it with cocos2d-x 3.0rc1, I don’t if it works with 2.0.3.

Anyway,


#3

@Chano Pardon me being so late to reply.Thank you so much.:slight_smile: .Could you tell me into which file you add the smoothstep,in “ccShader_PositionColor_frag.h”?And is the smoothstep an origin function in cocos2d-x,it soppurt opengl-es 2.0 or not?Thank you so much again.


#4

I don’t know if CCDrawNode is available in cocos2d-x 2.0.3 or not.

If you are using CCDrawNodes, you should modify its fragment shader.
In cocos2d-x 3.0, it’s in ccShader_PositionColorLengthTexture_frag.h.

Smoothstep should be available in OpenGL ES 2.0:
http://www.khronos.org/opengles/sdk/docs/man3/html/smoothstep.xhtml


#5

@Chano Thank you.I’ll have a try.:slight_smile: