[Solved]DrawNode each frame

Hi all! I’ve got a problem in cocos2d-x v 3.5
In my init()

drawer = DrawNode::create();
this->addChild(drawer);

I want to draw something every frame.
So I decided to do on every update -

drawer->clear();
drawer->drawDot(Vec2(100,100), 10, Color4F::WHITE);

But it doesn’t work
After the first drawer->clear() my dot disappears

What to do?

That code should work. If you comment out the ->clear() is the dot visible?

yep. Maybe it depends on my changing in ccShader_PositionColorLengthTexture.frag . For the smoothness drawing I edited that file like in this topic -

I use DrawPrimitives to draw geometry each frame. It was nice solution to draw trajectory in this project

I created project without changings in that ccShader, and it perfectly works but the Aliasing cut my eyes.

It was a fault in other my code.Now all works good.

1 Like