Problems drawing primitives

Hi, I’m trying to plot some simple graphs but I’m having a hard time wrapping my head around the primitive drawing utilities.

In particular, I wonder:

~~What is the preferred method for drawing now? I’ve checked the “CCDrawNode.js” test and it refers to “cc.drawingUtil” as “old API” and to “cc.DrawNode” as “new API”, should I only use this “new API”?
~~Why is there no documentation on the online API reference for this “cc.DrawNode”?
~~How can I make the drawPoly method of this “new API” leave the polygon open? It should be as easy as passing a “false” parameter like in the old API…
~~Additionally: in the file “CCDrawNode.js” it begins by saying “Code copied & pasted from SpacePatrol game https://github.com/slembcke/SpacePatrol”, is this really ready for use?

That said, I’ve had several strange errors, like an example copied and pasted not showing anything in one project but when placed within the source of another project it does work just fine.

Sebastián Vansteenkiste wrote:

~~What is the preferred method for drawing now? I’ve checked the “CCDrawNode.js” test and it refers to “cc.drawingUtil” as “old API” and to “cc.DrawNode” as “new API”, should I only use this “new API”?
I think you should use the “new API”, because it works better and more beautiful than the “old API” on WebGL mode.
>~~Why is there no documentation on the online API reference for this “cc.DrawNode”?
Thank you for your noticing, we will add the documentation of “cc.DrawNode” soon.

-How can I make the drawPoly method of this “new API” leave the polygon open? It should be as easy as passing a “false” parameter like in the old API…
I’m sorry to say that it doesn’t support that parameter.

I see, thanks!

I’ve messed around with it and with cc.drawingUtil and I’ve finally got them both to work, I had some minor misconceptions about the usage sintax. That said, I’m going to keep using the “old API” for now, as it seems more versatile and I definately need to draw some open polygons.

Since we are on that topic: are there plans to expand the drawing primitives to support a wider arrange of parameters, like the ones used for SVG drawings? (lines with different strokes, etc).

EDIT: Plus, I’ve just realized, “CCDrawNode.js” actually calls “cc.drawingUtil” in it’s code! So is it supposed to be another wrapper on top of the already existing drawing primitives? What’s the point?

EDIT 2 Edit Harder OK, I finally get it: cc.drawingUtil only works when used within (the scheduled draw function of a?) Sprite or any other type of node, while cc.DrawingNode is an element that has to be itself added to a layer and exposes the drawing functionality externally. So in my case, the right way to go is to use cc.drawingUtil since the polygons I want to draw are suppossed to be within a sprite, but I reckon the DrawingNode class may have it’s own right to exist.

That said, I think both approaches should use the same (or consistently named and functioning) methods. I can’t bear the thought of DrawingNode offering less (or inconsistent) functionality than drawingUtil (i.e. not being able to draw open polygons, the polygon drawing method having different parameters, not having a method for drawing rectangles, etc.).