[BUG] Visual Debugger + Double precision ogre

al2950

02-10-2009 17:30:05

There is a bug in the latest Git version of NxOgre which causes a seg fault when you try and draw the debug data from NxOgre when you are using Ogre in double precision mode.

The problem is caused by the buffer in NxOgre::VisualDebuggerMeshData being initialised to floats. However when it is sent to the renderer it is sent the buffer with a size of Ogre::Real which in my case is a double.

To fix simply change the function OGRE3DRenderable::drawVisualDebugger(NxOgre::VisualDebuggerMeshData* data)
from:

void OGRE3DRenderable::drawVisualDebugger(NxOgre::VisualDebuggerMeshData* data)
{
_resize(data->getNbLines(), 0);

// Write the vertices.
mVertexBuffer->writeData(0, 3 * data->getNbLines() * sizeof(Ogre::Real), data->getLines() );

mVertexColourBuffer->writeData(0, data->getNbLines() * sizeof(unsigned int), data->getColours() );

mBox.setInfinite();

}


To:
void OGRE3DRenderable::drawVisualDebugger(NxOgre::VisualDebuggerMeshData* data)
{
_resize(data->getNbLines(), 0);

// Write the vertices.
mVertexBuffer->writeData(0, 3 * data->getNbLines() * sizeof(float), data->getLines() );

mVertexColourBuffer->writeData(0, data->getNbLines() * sizeof(unsigned int), data->getColours() );

mBox.setInfinite();

}


Or you could change the buffer in NxOgre::VisualDebuggerMeshData from <float> to <Ogre::Real>, actually thats probably a better idea!

betajaen

02-10-2009 18:55:39

Please see:

http://github.com/betajaen/nxogre/issue ... ment/55153