Page 1 of 1

2.1 ManualObject in release mode not visible

Posted: Wed Jan 02, 2019 2:36 pm
by Lax
Ogre Version: 2.1 :?:
Operating System: Windows 10 :?:
Render System: Any :?:

Hi,

I'm really desperate, as I tried everything, but somehow my manual object is only visible in debug mode, but not in release mode, no matter what I do. I tried everything.

I want to draw physics collision lines for a mesh.

Code: Select all

m_debugCollisionLines = m_sceneManager->createManualObject(isStatic ? Ogre::SCENE_STATIC : Ogre::SCENE_DYNAMIC);
m_debugCollisionLines->setRenderQueueGroup(250); // Render in foreground
m_debugCollisionLines->setQueryFlags(0 << 0);
m_debugCollisionLines->setCastShadows(false);
((Ogre::SceneNode*)m_node)->attachObject(m_debugCollisionLines);
m_debugCollisionLines->begin("GreenNoLighting", Ogre::OperationType::OT_LINE_LIST);
...
m_debugCollisionLines->position(p0);			
m_debugCollisionLines->position(p1);
m_debugCollisionLines->line(a++, a++);
...
m_debugCollisionLines->end();

GreenNoLighting Is an unlit material which does exist. Also in the Ogre.log there is nothing suspicious. I get not error nothing. The lines are just not there :(

Has somebody any clue that might help?

Thanks in advance
Lax

Re: 2.1 ManualObject in release mode not visible

Posted: Sat Jan 05, 2019 10:56 am
by Boost113
I can't say that I'd experienced this problem before. But whenever I have trouble with Ogre I usually use RenderDoc to see what is actually going on.

One idea I have regarding this issue specifically is that if you aren't setting the bounding box the object might get culled immediately (and due to memory initialization etc. that behaves differently in release mode).

Re: 2.1 ManualObject in release mode not visible

Posted: Sun Feb 03, 2019 10:54 am
by Lax
I could solve the issue. Something messy is going on when using ManualObject2 to create lines and using line(index1, index2) to build the indices.

So I changed:

Code: Select all

m_debugCollisionLines->position(p0);
m_debugCollisionLines->position(p1);
m_debugCollisionLines->line(a++, a++);
To:

Code: Select all

m_debugCollisionLines->position(p0);
m_debugCollisionLines->index(a++);
m_debugCollisionLines->position(p1);
m_debugCollisionLines->index(a++);
I could not find out what is wrong with 'line' and it cost lots of nerves.

Best Regards
Lax

Re: 2.1 ManualObject in release mode not visible

Posted: Sun Feb 03, 2019 4:06 pm
by dark_sylinc
Do not use dodgy expressions such as 'm_debugCollisionLines->line(a++, a++);'

It is not easy to tell whether it will become line( 0, 1 ) or line( 1, 0 ) and for some versions of C++ it is undefined in which order it should be updated. See unsequenced errors and C++

Cheers

Re: 2.1 ManualObject in release mode not visible

Posted: Sun Feb 03, 2019 8:18 pm
by Lax
Thanks for pointing that out! I never thought about that phenomen.