Projects > cpp > Issues > Bug #5573

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

Create Issue on Github

DrawNode + Sprite produces drawing artefacts

Bug #5573 [Closed]
vladu_bogdan 2014-06-17 12:21 . Updated about 8 years ago

Hello everybody,

When using a DrawNode together with multiple sprite frame Sprite drawing has bad artefacts.
Most of the time it will work ok but every once in a while artefacts are present. This looks to me that a pointer is not set to NULL in the constructor and gets garbage data.
A simple DrawNode with no sprites added to the scene will not produce the artefacts.

I want to stress out that this does not always reproduce and the user has to launch the app several times.
This happens in both 3.0 and 3.1.1

I have attached a couple of images showing the problem.

Screen Shot 2014-06-17 at 13.30.27.png (65 kB) vladu_bogdan, 2014-06-17 12:21

Screen Shot 2014-06-17 at 14.04.43.png (87.1 kB) vladu_bogdan, 2014-06-17 12:21

Screen Shot 2014-06-17 at 13.58.25.png (71.2 kB) vladu_bogdan, 2014-06-17 12:21

Screen Shot 2014-06-17 at 14.04.14.png (67.5 kB) vladu_bogdan, 2014-06-17 12:21

Screen Shot 2014-06-17 at 14.04.26.png (84.9 kB) vladu_bogdan, 2014-06-17 12:21

Screen Shot 2014-06-17 at 15.22.17.png (83.9 kB) vladu_bogdan, 2014-06-17 12:23

vladu_bogdan 2014-06-17 12:23

Screenshot without the problem.

vladu_bogdan 2014-06-17 12:38

For completeness - the DrawNode is used this way

void LHWater::setShapeTriangles(__Array* triangles, const Color4F& c4)

for(int i = 0; i < triangles->count(); i+=3)
    LHPointValue* valA = (LHPointValue*)triangles->getObjectAtIndex(i);
    LHPointValue* valB = (LHPointValue*)triangles->getObjectAtIndex(i+1);
    LHPointValue* valC = (LHPointValue*)triangles->getObjectAtIndex(i+2);

    Point pA = valA->getValue();
    pA.y = -pA.y;

    Point pB = valB->getValue();
    pB.y = -pB.y;

    Point pC = valC->getValue();
    pC.y = -pC.y;

    _drawNode->drawTriangle(pA, pB, pC, c4);


Sheado 2014-08-21 02:32


I'm seeing the same problem. DrawNode is important to us because we want to use it for drawing in-game content - not just debug stuff.
Anyway, I've noticed that commenting out the following in onDraw seems to fix the problem for me, but perhaps at a performance cost? (speaking of which - DrawNode is extremely inefficient for some reason).

//    if (Configuration::getInstance()->supportsShareableVAO())
//    {
//        GL::bindVAO(_vao);
//    }
//    else
vladu_bogdan 2014-08-21 04:27

Hi Sheado,

This bug has been posted here for a long time and nobody acknowledge it.

For LevelHelper 2 i ended up creating my own draw node (with texture support). Have a look here

You want to look at LHDrawNode - it should be pretty simple to port in order to use it without the LeveHelper2-API code.

Sheado 2014-08-21 19:30

Thanks for the code @vladu.bogdan. I'll take a look.

naghekyan 2014-09-12 17:37

@vladu.bogdan @Sheado I guess another expression of the same bug is here:

zhangxm 2014-09-13 01:50
  • Assignee set to huangsw
  • Target version set to v3.3

Sorry about late reply. We will take a look.

naghekyan 2014-09-13 08:25

@zhangxm thank you for taking care. I tried to fix, but could not. Not fluent in OpenGL yet. But in my link above (stackoverflow) I have added screenshots and there is also the code. It would be a very good starting point for the developer who is going to fix it.

zhangxm 2014-09-25 02:14
  • Status changed from New to Closed
huangsw 2014-09-25 09:06

@vladu.bogdan @Sheado @naghekyan
thank you for your feedback, this problem seems to have already fixed in the newest version, the problem maybe caused by the code in DrawNode's drawTriangle function:
unsigned int vertex_count = 2*3

you should change the code to:
unsigned int vertex_count = 3

Atom PDF

Start date:2014-06-17
Due date:
% Done:


Category:ios, mac
Target version:v3.3