Line drawing not working in 3.0rc


#1

Hello,

my problem is that lines don’t draw anymore on cocos2dx 3rc (it worked in alpha0).

I’m doing it like this:

// setup
scene->addChild(gameMainLayer);
scene->addChild(myGUIlayer);
scene->addChild(debugLayerForGame); // this doesn't draw lines anymore
scene->addChild(debugLayerForGUI);

// in my game world debug class:
virtual void draw(cocos2d::Renderer *renderer, const kmMat4& transform, bool transformUpdated)
{
       cocos2d::DrawPrimitives::setDrawColor4F(...);
       cocos2d::DrawPrimitives::drawLine(...);
}

Am I missing something in the new draw function?

Edit: I also tried debugging OpenGL with AMD GPU Perf Studio in Windows 8, but it doesn’t want to connect( though this is supposedly an issue with GPU Perf studio not liking Windows8).


#2

I figured out the problem:
because of the new rendering system the ‘cocos2d::DrawPrimitives::drawLine’ call won’t work because it isn’t bathed like the rest (so setting global/local Z layer doesn’t work).

To draw the lines I hacked the Director::drawScene and put my render commands after the ’ _renderer->render();’ line.

Would the proper way be to issue your own custom command for the renderer to draw stuff like this “the proper way”?


#3

ropo i didnt understood how you solved the problem, can you show us the code of the overriden draw funct?