nel-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nel] GNU/Linux ... snowballs is running


From: Loic Dachary
Subject: [Nel] GNU/Linux ... snowballs is running
Date: Wed, 13 Feb 2002 00:07:39 +0100

        Hi,

        Thanks to GDB I was able to find a temporary solution. Now
snowballs is running at an incredible 0.5fps rate. It's probably the
first time I'm delighted to see such a slow opengl application ;-) Now
I'll have to buy some RAM (GDB eats ~300Mb) and a decent graphical
card with a Free Software driver.

        I used the following workaround:

Index: nel/src/3d/scene.cpp
===================================================================
RCS file: /home/cvsroot/code/nel/src/3d/scene.cpp,v
retrieving revision 1.62
diff -u -r1.62 scene.cpp
--- nel/src/3d/scene.cpp        6 Feb 2002 16:54:56 -0000       1.62
+++ nel/src/3d/scene.cpp        12 Feb 2002 22:53:55 -0000
@@ -463,7 +463,7 @@
 #endif
 
        // Look if this instance get lightmap information
-       CMeshBase *pMB = dynamic_cast<CMeshBase*>( (IShape*)(pTShp->Shape) );
+       CMeshBase *pMB = (CMeshBase*)((IShape*)(pTShp->Shape));
        CMeshBaseInstance *pMBI = dynamic_cast<CMeshBaseInstance*>( pTShp );
        if( ( pMB != NULL ) && ( pMBI != NULL ) )
        { // Try to bind to automatic animation

        I managed to get snowballs to run on GNU/Linux. It turns out that
dynamic_cast<CMeshBase*>((IShape*)(pTShp->Shape)) returns a pointer that is
4 bytes below the expected pointer. Replacing the dynamic_cast with a C 
style cast fixes the issue.

        Unless I'm mistaken, there is no reason for dynamic_cast to
return a pointer that is different from a C style cast (except if the
cast is not legitimate). Hence I guess it's some sort of compiler
bug. I'll try to re-compile with gcc-3 (currently using gcc-2.95.4) +
isolate the problem. That one was pretty easy to spot because, we may
run into much more tricky problem if it is not investigated properly.

        Cheers,

-- 
Loic   Dachary         http://www.dachary.org/  address@hidden
12 bd  Magenta         http://www.senga.org/      address@hidden
75010    Paris         T: 33 1 42 45 07 97          address@hidden
        GPG Public Key: http://www.dachary.org/loic/gpg.txt


reply via email to

[Prev in Thread] Current Thread [Next in Thread]