The drawPolygon method creates low definition elements

Premise

Hello, after trying to understand the reason of this annoying error for all the weekend i surrender and ask it here, i hope you won’t mind to much. I have no deep understanding of cocos and it might and most certainly is a banality, but google has no answers apparently for this particular issue.

What’s wrong?

The problem is simple: if i draw a sprite or a text, is in hd. If i draw a square or a rectangle tilted, the rectangle shows the saw-like teeth usually related to a low definition.
I’ve tried to define the anti-aliasing for the DrawNode elements, no success.
I’ve also tried to sed manually the definition for my device, but still no success.

Here’s an image of the problem:

As you can see, the red polygon is with a low definition upper side.

##The code
Here’s the code, very simple and commented to the bones:

// Defining array of angles of the new background element
Point vertices[4];

// Starting Height of new background element
float startHeight = 100;
// Ending Height of new background element
float endHeight = 200;

// Color of the background element, a strong red
Color4F color = Color4F(1, 0, 0, 1);

// Define the new polygon
DrawNode* polygon =  DrawNode::create();
// First Point
vertices[0] = Vec2(0, startHeight);
// Second point
vertices[1] = Vec2(visibleSize.width, endHeight);
// Third Point
vertices[2] = Vec2(visibleSize.width, 0);
// Forth Point
vertices[3] = Vec2(0, 0);
// Print the polygon
polygon->drawPolygon(vertices, 4,  color, 0,  Color4F(0, 0, 0, 0));
addChild(polygon);

If anything else might be useful to understand the nature of the problem, ask it and i’ll add it to this question asap.

See this thread…


I fixed this for v4-develop branch only, but all the info you need to fix it for v3.x is in there…
Good luck!

Hello and thanks,

I’ve applied your solution and created a new project but no result are achieved.
I’m on mac and i’m testing on the xcode ios emulator.

Sorry it didn’t work for you. Are you using v3.x???
Busy at the moment, but i’ll try to look into iOS and Mac over the next few days.
I know for certain that it can be done. I had anti-aliasing working just fine in cocos2d-x v2.

The version is 3.4.
Are there any other information that may be useful for you?

1 Like