Hello. Sorry for the delay. Maybe someone managed to compile Erlang following the steps I posted a couple of weeks ago. Here are my notes regarding ESDL and Wings 3D.
Remember: GCC and GNU make required.
ESDL
Using the latest version, 0.96.0626, I followed installation instructions; only had to make these two changes before building:
- in c_src/Makefile, change $OGLDIR/lib to $OGLDIR/lib32
- add "-mips4" and other desired flags to CFLAGS
Previous to this I compiled my own libSDL, but I don't remember it needing special configuration options and this doesn't seem to be a must: nekoware SDL should be fine.
Wings 3D
Using 0.98.35, the latest at the time I tried.
in plugins_src/accel/Makefile:
- remove calls to "install -d $(LIBDIR)" (they fail on my box)
- create directory plugins/accel by hand
- correct GCC definition (add "-mips4" etc)
in plugins_src/autouv/shaders/Makefile:
- remove calls to "install -d $(DIR)"; no need to create anything in this case
It is best to copy (or link) the wings-0.98.35 directory to the lib/erlang/lib directory of your Erlang installation; the same goes for esdl-0.96.0626. That way Erlang will automatically incorporate them to the code path when it boots.
If all goes well you'll now have compiled Wings 3D, but it will lock up as soon as you launch it. Turns out this is because a division by zero causes the emulator (Erlang parlance for VM) to hang, instead of throwing a badarith exception as it should, and a number of these happen while converting from RGB to HSV. Maybe on some other places as well. I've yet to ask some questions in the Erlang mailing list regarding this issue.
At least two source files, wings_init.erl and wings_color.erl, must be patched. I have a 50-line patch file, but there doesn't seem to be a way to attach it to this message, so there it goes.
Code:
Select all
--- wings_init.erl Tue Apr 12 19:31:03 CEST 2005
+++ wings_init.erl.ds Tue Nov 07 23:07:58 CET 2006
@@ -19,7 +19,7 @@
-include("wings.hrl").
init() ->
- macosx_workaround(),
+% macosx_workaround(),
os:putenv("SDL_HAS3BUTTONMOUSE", "true"),
wings_pref:set_default(window_size, {780,570}),
--- wings_color.erl Sun Jan 23 10:34:56 CET 2005
+++ wings_color.erl.ds Tue Nov 07 23:07:57 CET 2006
@@ -137,6 +137,11 @@
HSV -> HSV
end.
+safe_div(Q, D) ->
+ case D == 0.0 of
+ true -> throw(badarith);
+ false -> Q / D end.
+
internal_rgb_to_hsv(R, G, B) ->
Max = lists:max([R,G,B]),
Min = lists:min([R,G,B]),
@@ -143,14 +148,21 @@
V = Max,
{Hue,Sat} = try
{if
- Min == B -> (G-Min)/(R+G-2.0*Min);
- Min == R -> (1.0+(B-Min)/(B+G-2.0*Min));
- Min == G -> (2.0+(R-Min)/(B+R-2.0*Min))
- end*120,(Max-Min)/Max}
+ Min == B -> safe_div(G-Min, R+G-2.0*Min); %(G-Min)/(R+G-2.0*Min);
+ Min == R -> 1.0+safe_div(B-Min, B+G-2.0*Min); %(1.0+(B-Min)/(B+G-2.0*Min));
+ Min == G -> 2.0+safe_div(R-Min, B+R-2.0*Min) %(2.0+(R-Min)/(B+R-2.0*Min))
+ end*120,safe_div(Max-Min, Max)} %(Max-Min)/Max}
catch
- error:badarith ->
+% error:badarith ->
+ badarith ->
{undefined,0.0}
end,
+% {Hue, Sat} = case Max == 0.0 of
+% false -> {if Min == B -> (G-Min)/(R+G-2.0*Min);
+% Min == R -> (1.0+(B-Min)/(B+G-2.0*Min));
+% Min == G -> (2.0+(R-Min)/(B+R-2.0*Min)) end*120,
+% (Max-Min)/Max};
+% true -> {undefined, 0.0} end,
{Hue,Sat,V}.
hsv_to_rgb(H, S, V) ->
It seems phpBB does not preserve tabs; maybe the 'patch' utility will complain if you just copy this into a file and attept to patch the Wings 3D source with that. In any case, please feel free to request the real patch file by email: I'm 'dsolaz' at domain 'sistelcom' dot com (note that I'll be offline from Nov 9 to 12).
Better yet, read my forthcoming post regarding the creation of tardist files of Erlang, ESDL and Wings 3D. With them, getting a (hopefully) working Wings 3D should be much easier for everyone.
I'd like to hear from people who try this. Specially those working on machines other than what I have: an O2 and an Octane/SSE running 6.5.26 with GCC 3.3. Thanks in advance.
-Daniel