I thought this was a bug in version cocos2d-x 3.0beta, and fixed in RC0, as mentioned here.
However it seems that it is still happening. Is it actually a bug?
What is the way, say, to draw primitives on top of sprites?
I thought this was a bug in version cocos2d-x 3.0beta, and fixed in RC0, as mentioned here.
However it seems that it is still happening. Is it actually a bug?
What is the way, say, to draw primitives on top of sprites?
You have to use CustomCommand
checkout ShaderTest.cpp
@nite Thanks, I managed to make it work using CustomCommand
This helped me understand cocos2d-x 3.0 rendering:
https://docs.google.com/document/d/1-BEz4i8xxSbZp0msfoPuwpmFfu7bx-9rajhZJNDu7LM/edit?pli=1# (google translated into English)
For a simple equivalent to the draw() function in cocos2d-x 3.0, this is how I implemented it:
CustomCommand* renderCommand = new CustomCommand();
renderCommand->init(10); // or whichever depth
renderCommand->func = customDraw;
Then each frame call:
auto director = Director::getInstance();
director->getRenderer()->addCommand(renderCommand);
@Romain Awesome - thanks for this:
Would it be possible for you to post a more complete sample of the code (i.e. what is in the customDraw method)
I’m a bit of a noob at C++ and I’m getting errors if I use the code you posted with a ‘customDraw’ method of my own…
Thanks!
[UPDATE]
No need, I checked out the demo sources and, once I knew what I was looking for, it all sort of made sense!
Thanks