fstl-app / fstl

A fast STL file viewer
463 stars 106 forks source link

FSTL is not able to load stl files in a big endian environment (PowerPC) #72

Closed mercurioblu closed 3 years ago

mercurioblu commented 3 years ago

I would like to use FSTL on my Debian installation working on a PowerPC CPU and a 64bit linux environment. If I try to load any STL file, FSTL does exactly nothing, it does not show any object, nor provided an alert of any kind that something went wrong. I tried recompiling from source code the current version from this repository, but again FSTL seems to ignore any STL file I select. I might be probably wrong, but it seems to me that STL files I am trying to load with FSTL are encoded as little endian and the FSTL loader is not able to detect that it is running on a big endian system.

DeveloperPaul123 commented 3 years ago

Would you be able to share the file that fstl cannot load?

mboerwinkle commented 3 years ago

Also, a few other things that might be interesting: -Can you load this (Sphericon.stl) ascii STL? -What Debian port are you using? You say it is big endian, but https://www.debian.org/ports/ only lists little endian PPC as currently supported. Thanks, Martin

mkeeter commented 3 years ago

We copy directly from the binary file into a float here. You can try editing that line to something like

qFromLittleEndian<float>(b, 3, &v[i]);

and seeing if that fixes it.

mercurioblu commented 3 years ago

Here the file I am trying to load, zipped as GitHub does not allow to upload an stl file directly flat.zip

mercurioblu commented 3 years ago

@mboerwinkle Yes, I can see the file "Sphericon.stl" image

The following is the dump of my /etc/apt/sources.list

# Repos managed by Debian ports
deb http://ftp.ports.debian.org/debian-ports/ sid main 
deb-src http://ftp.debian.org/debian/ sid main 
deb [arch=all] http://ftp.debian.org/debian/ sid non-free contrib main 
# Repo managed by PowerProgressCommunity
deb [arch=ppc64] https://repo.powerprogress.org/debian/ sid main 
mkeeter commented 3 years ago

Did you try the fix I suggested here?

mercurioblu commented 3 years ago

@mkeeter Hurray, yes, replacing memcpy(&v[i], b, 3*sizeof(float)); with qFromLittleEndian<float>(b, 3, &v[i]); in src/loader.cpp#L172 did the trick! Thank you!!

image

Could you please include this fix in the main branch so that Debian will get it in their repositories?

Unfortunately I now have another issue, the file loader dialog does not show up any *.stl file as it did previously and to load files I have to launch fstl from terminal providing the filename to load. On the image below, on left there is fstl installed from Debian repo and on the right the fstl I just compiled from sources with the patch you provided but that does not allow me to load any stl file, do you want me to open another issue about this?

image

sur5r commented 3 years ago

The version in Debian does not yet include the fix for #59. So I think #60 is the relevant change here. I don't understand yet how it can break like that...

mkeeter commented 3 years ago

Okay, fixed in 843415dccdcf9d15322f84c3e4b2cbd8515283b6.

Please open another issue for the file dialog, but let me ask – what happens if you click on "STL files" in the lower-right corner of the file dialog? If that opens a dropdown that lets you pick between "STL files" and "*.stl", then it's probably your shell (GNOME?) behaving strangely.