3d graphic code stalls
A Logo programming environment for Microsoft Windows
Brought to you by:
david_costanzo
I had some 3d shapes someone shared on the LogoForum and I tried to run them again. I opened the attached file.
I typed:
aaa
in the command center.
The first shape starts to be drawn but just before it finishes it stalls and my laptop starts overheating. The process never ends. I have to kill the FMSLogo app.
I was able to reproduce the problem as far back as FMSLogo 7.0.0. I was unable to reproduce it on FMSLogo 6.35.0 OWL or FMSLogo 6.35.0 wxWidgets. CHANGELOG.TXT gives a lot of changes for FMSLogo 7.0.0, but very few related to 3D graphics.
I ran the program under valgrind on GNU/Linux and it reported some heap corruption (freed memory read) deep in the BSP tree construction.
I managed to compile the source code for FMSLogo 6.35.0 wxWidgets with the build tools that I currently use to compile the 8.X series. I was not able to reproduce the problem in the resulting executable. This suggests that this is a regression that I made to the source code, not a change to the compiler or the C runtime.
In looking at the difference in the polygon code (threed.cpp and 3dsolid.cpp), it looks like I cleaned up 3dsolid.cpp by removing, among other thing, the precompiler switches NO_ASM and SHARED and retained whatever code was used in FMSLogo 6.35.0 (removed the #ifdef NO_ASM blocks and kept the #ifdef SHARED blocks). I see two mistakes that I made in this process.
I released FMSLogo 7.0.0 (the first version with the bug) on 2017-02-22. It took more than seven years for someone to find the regression. I have some simple polygon regression tests, but nothing complex. This suggests that no one has use the polygon functionality for something this complex in seven years.
That's why I wanted to resurface them again. So that more people are aware that FMSLogo is capable of doing those things. All I see as Logo Youtube videos is children drawing squares.
This is fixed by [r6046]. I fixed this by comparing the current 3dsolid.cpp with the 3dsolid.cpp from 6.35.0 and correcting mistakes I made when cleaning it up. I do not claim to understand the code.
This fix will be available in FMSLogo 8.4.0.
Related
Commit: [r6046]
thanks! appreciate it.
By the way, the code you attached demonstrates a second bug in FMSLogo. For example,
vecprodis implemented as:The first line should just be
When run in UCBLogo it throws an error
I think UCBLogo has the correct behavior. If you want to post this code, be aware that I may fix this second bug in a future version of FMSlogo, which would render the program unrunnable.