Debug Lines Not Working

RedEyeCoder

09-08-2007 10:19:18

Hey,

I am compiling OgreNewt as a static library and can not get debug lines to render. I have tried setting the preprocessor "_OGRENEWT_DEBUGGER_DAGON" in the project settings but it still does not work.

FYI, I am using the head CVS version of Ogre and the latest download from the walaber website for ogrenewt.

Any ideas what I am doing wrong?

walaber

09-08-2007 19:04:17

you don't need _OGRENEWT_DEBUGGER_DAGON anymore, the debugger only uses ManualObject now since the release of Dagon.

are you calling OgreNewt::Debug::getSingletion().init() before you try to draw the lines?

RedEyeCoder

09-08-2007 23:58:37

Not exactly.

I do;


m_World = new OgreNewt::World();
OgreNewt::Debugger::getSingleton().init( m_SceneManager );
OgreNewt::Debugger::getSingleton().showLines( m_World );


Is there anything else required?

walaber

10-08-2007 08:13:56

that ought to do it. it you step through in the debugger, are the various functions in Debugger being called?

RedEyeCoder

10-08-2007 09:31:04

Do I need to call it every frame? I can step through the debugger init and showlines function nps..

RedEyeCoder

10-08-2007 09:32:34

omg. It works when I called showlines EVERY frame/update... is this meant to happen?!

walaber

11-08-2007 01:27:09

hmmm... it should work even if you call it just once (the lines should just stay onscreen)... I'm not sure why you need to call it every frame for it to work, that is strange. perhaps your objects were overlapping the lines making them impossible to see?

RedEyeCoder

11-08-2007 05:21:54

No, If i stop calling it, the lines just stay where they were last rendered...

walaber

11-08-2007 06:48:29

good, it works then. there may be a bug that it doesn't draw anything in the first call only, after that it may work ok.

mh

15-08-2007 13:50:20

Hi walaber, I noticed a crash at exit when using OgreNewt debug lines.

In OgreNewt_Debugger.cpp you're creating the m_debuglines ManualObject with the operator new, instead of using smgr->createManualObject(...). :)

It's a very simple fix:

1. add private Ogre::SceneManager* m_scenemanager to the Debugger class.

2. Then in OgreNewt_Debugger.cpp:

void Debugger::init( Ogre::SceneManager* smgr )
{
m_scenemanager = smgr;
m_debugnode = smgr->getRootSceneNode()->createChildSceneNode("__OgreNewt__Debugger__");
m_debuglines = NULL;
m_debuglines = smgr->createManualObject("__OgreNewt__Debugger__");
}


and

void Debugger::deInit()
{
if (m_debugnode)
{
m_debugnode->detachAllObjects();
if (m_debuglines) {
m_scenemanager->destroyManualObject(m_debuglines);
m_debuglines = NULL;
}
m_debugnode->getParentSceneNode()->removeAndDestroyChild( m_debugnode->getName() );
m_debugnode = NULL;
}
}


Hopefully this get's applied to the next version. :)

walaber

15-08-2007 16:26:21

nice catch! I'll update the code.

mh

15-08-2007 19:52:55

nice catch! I'll update the code.
No problem! :) Thanks a lot for OgreNewt btw, very nice stuff. I'm finally getting something cool out of my platformer project (I abandoned my 2d engine and switched to Ogre).. When I get to the character movement I expect some troubles, so I guess I'll be making threads here sooner or later.. ;)