[SOLVED] PagedGeometry crash

noFreak

20-11-2007 22:47:04

I want to continue this post http://www.ogre3d.org/phpBB2/viewtopic.php?t=37112.

I have had the same problem. At first i have stepped the

mTrees->addDetailLevel<BatchPage>(150, 30);

method and have detected that in following code
template <class PageType> inline void GeometryPageManager::initPages(const TBounds& bounds)
{
// Calculate grid size, if left is Real minimum, it means that bounds are infinite
// scrollBuffer is used as a flag. If it is allocated than infinite bounds are used
// !!! Two cases are required because of the way scrolling is implemented
// if it is redesigned it would allow to use the same functionality.
if(bounds.width() < 0.00001)
{
// In case of infinite bounds bounding rect needs to be calculated in a different manner, since
// it represents local bounds, which are shifted along with the player's movements around the world.
geomGridX = (2 * farTransDist / mainGeom->getPageSize()) + 4;
gridBounds.top = 0;
gridBounds.left = 0;
gridBounds.right = geomGridX * mainGeom->getPageSize();
gridBounds.bottom = geomGridX * mainGeom->getPageSize();
// Allocate scroll buffer (used in scrolling the grid)
scrollBuffer = new GeometryPage *[geomGridX];
which is called by addDetailLevel(), everytime the method mainGeom->getPageSize() was called, the return value was zero. And at this you can find the crash, a divided by zero "error":

geomGridX = (2 * farTransDist / mainGeom->getPageSize()) + 4;

But why this method ever and ever return zero???
I have stepped the constructor from pagedGeometry and the
void PagedGeometry::setPageSize(Real size)
method and have detected that the assignment
PagedGeometry::pageSize = pageSize; in both of following has no effect...//Method
void PagedGeometry::setPageSize(Real size)
{
if (!managerList.empty())
OGRE_EXCEPT(0, "PagedGeometry::setPageSize() cannot be called after detail levels have been added. Call removeDetailLevels() first.", "PagedGeometry::setPageSize()");

pageSize = size;
}

//Constructor
PagedGeometry::PagedGeometry(Camera* cam, const Real pageSize)
{
//Setup camera and scene manager
if (cam){
sceneCam = cam;
sceneMgr = sceneCam->getSceneManager();
oldCamPos = sceneCam->getDerivedPosition();
} else {
sceneCam = NULL;
sceneMgr = NULL;
oldCamPos = Vector3::ZERO;
}

//Init. timer
timer.reset();
lastTime = 0;


//Setup page size / bounds
PagedGeometry::pageSize = pageSize;
m_bounds = TBounds(0, 0, 0, 0);

//Misc.
pageLoader = NULL;
}


But I think this behaviour depends on my linker warnings:

1>PagedGeometry.lib(TreeLoader3D.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
1>Embedding manifest...
1>PagedGeometry.lib(TreeLoader3D.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

And i can only note this behavior when i use the release version of the PagedGeometry.lib. When I use the _d.lib in my solution theres no Problem :roll: ... any idea?

JohnJ

21-11-2007 00:27:29

That's weird that the page size isn't being set like that. Are you also using the editable terrain scene manager?

JohnJ

30-11-2007 22:15:10

I just tested this and I can't seem to reproduce - ETM seems to work just fine with PagedGeometry. Can you give you any further details that might help me reproduce?

noFreak

13-12-2007 21:57:01

I dont think its a PagedGeometry bug because it works really fine in the moment...
I don't have recompiled the PagedGeometry lib's but although there are no linker warnings in my solution when i compile my ogre application...
Unfortunaly i can't say what i have changed in my solution...maybe it was quite simply wrongly configured?!?
I rather think its a compiler/linker mistake than a PagedGeometry bug...but i realy can't analyse the root of the problem...
Do anybody know what the linker warnings means?
Thx for effort to tracking this "bug"

JohnJ

13-12-2007 23:36:54

Ok, I'm glad it's working now at least - I guess it's possible that the problem had something to do with a linker problem.

I don't know what the linker warnings mean right now. Maybe a google search will help.

klanger13

13-01-2008 20:33:33

Just in case anyone else has a problem with this. I think its caused by accidentally using a release version instead of a debug one. Thats what caused it for me anyway. :)