Mandelbulber for mac

From VoidWarranties - Hackerspace Antwerp, Belgium
Jump to: navigation, search

Mandelbulber for mac

"Mandelbulber is an easy to use, handy but experimental application designed to help you render 3D Mandelbrot fractals called Mandelbulb and some other kind of 3D fractals like Mandelbox, Bulbbox, Juliabulb, Menger Sponge"

Mandelbulber small.jpg
Den Bunker, Terra

Hallo! these are a few links that may explain a bit what is it all about: see the gallery of the author:

I would like to build version 1.12.1 and version 1.13 an updated release and a version using openCL ( At the moment I don't have a mac ): so I hope somebody will help me to continue to distribute this software. One can download a binary for OS 10.4 (powerPC and intel) and for OS 10.5+ (32 or 64 bit) the latest mandelbulber with X11 is here:

I usually use macports to create the libs (GTK2) that are necessary to build mandelbulber, but it would be nice to create a proper bundle (maybe using GTK+ Latest thing: even if not really necessary it would be nice to create a port for mac ports.

Trip to center of hybrid fractal

So far I was not able to upload the binary to sourceforge nor I know if I will be able to do it in the future.It was possible to build a GTK version without X11. Jhbuild and GTK-OSX were used to build mandelbulber 1.16, gtk-mac-bundler was used to create a bundle for it.

Once jhbuild and gtk are installed, before I build, I set things this way using terminal:
export CPFLAGS="-I$HOME/gtk/inst/include"
export LDFLAGS="-L$HOME/gtk/inst/lib"

You might install freetype as well:
~/.local/bin/jhbuild build freetype
my own file is
LIBS := -lgthread-2.0 -lglib-2.0 -lgtk-quartz-2.0 -lgdk-quartz-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lgthread-2.0 -lglib-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lpng -ljpeg -lgobject-2.0
It could be necessary to omit the brackets of "mandelbulber" when building using terminal (see makefile); this is not the case when you are using gcc 4.8+; this means that probably you compiled and installed yourself a more recent version of the one provided by Apple.
To create the app.bundle, once the binary is inside ~/gtk/bin I just do:
~/.local/bin/jhbuild shell
cd ~/.local/bin
./gtk-mac-bundler /Users/bermarte/mandelbulber.bundle

this is a pretty standard mandelbulber.bundle:

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->

    <!-- Where to pick up the GTK+ installation, icon themes,
         etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the
         value of the environment variable JHBUILD_PREFIX. You can
         define additional prefixes and refer to them in paths
         throughout this file on the form "${prefix:name}". This is
         useful for installing certain libraries or even the
         application itself separately. Note that JHBUILD_PREFIX is
         defined by jhbuild, so it you are not using jhbuild you can
         either define your own or just hardcode the path here.
    <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
    <!--example of prefix: <prefix name="stuff">/Extra/mandelbulber_GTK/inst</prefix>-->
    <!-- The project directory is the default location of the created
         app. If you leave out the path, the current directory is
         used. Note the usage of an environment variable here again.
    <destination overwrite="yes">${env:HOME}/Desktop</destination>

      <!-- Not implemented yet (DMG image). -->

    <!-- Comment this out to keep the install names in binaries -->
    <!-- Optionally specify a launcher script to use. If the
         application sets up everything needed itself, like
         environment variable, linker paths, etc, a launcher script is
         not needed. If the source path is left out, the default
         script will be used.
    <launcher-script>${project}/</launcher-script >

    <!-- Not implemented: Optional runtime, could be python or mono
         for example.
    <!-- runtime copy="yes">/usr/bin/python</runtime -->
    <!-- Indicate the active gtk version to use. This is needed only
         for gtk+-3.0 projects. -->

  <!-- The special macro "${project}" refers to the directory where
       this bundle file is located. The application name and bundle
       identifier are taken from the plist file.

  <!-- Copy in GTK+ modules.  Note the ${gtkdir} macro, which expands
       to the correct library subdirectory for the specified gtk


  <!-- Copy in GTK+ theme engines and print backends. Note the use of the
       "${pkg:module:variable}" macro, which evaluates to a pkg-config
       variable in the specified module. Note that any libraries that
       binaries link to are also copied in automatically.  Note also
       the included ${gtk} macro, which gets the correct package name
       to get. -->


<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->



 <!-- Translation filenames, one for each program or library that you
       want to copy in to the bundle. The "dest" attribute is
       optional, as usual. Bundler will find all translations of that
       library/program under the indicated directory and copy them.-->
  <translations name="gtk20">

  <!-- Data to copy in, usually Glade/UI files, images, sounds files
       etc. The destination inside the bundle can be specified if the
       files should end up at a different location, by using the
       "dest" property. The destination must then start with the macro
       "${bundle}", which refers to the bundle root directory.
  <!-- data>
  </data -->

  <!-- Copy in the themes data. You may want to trim this to save space
       in your bundle. -->

  <!-- Copy icons. Note that the .icns file is an Apple format which
       contains up to 4 sizes of icon. You can use
       /Developer/Applications/Utilities/Icon to import
       artwork and create the file. >
  <data dest="${bundle}/Contents/Resources">

  <!-- This is where theme commands go. You can copy them in from your
       theme of choice if they provide and example, or you can just
       change the source path. -->

  <data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc">

  <!-- Icon themes to copy. The "icons" property can be either of
       "auto", "all", or "none". All or none should be
       self-explanatory, while auto means that the script will try to
       figure out which icons are needed. This is done by getting all
       the strings from all copied binaries, and matching them against
       icon names. To be safe, you should use "all". "none" is useful
       if you want just the index.theme file but no icons, mostly
       needed for the "hicolor" base theme.
 <icon-theme icons="auto">
  </icon-theme -->  

Other files, together with the bundler file and in the same location, are needed


this is otool -L mandelbulber's output (The otool command displays libraries used by file):
@executable_path/../Resources/lib/libgthread-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libglib-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libgtk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.16.0)
@executable_path/../Resources/lib/libgdk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.16.0)
@executable_path/../Resources/lib/libatk-1.0.0.dylib (compatibility version 20610.0.0, current version 20610.1.0)
@executable_path/../Resources/lib/libgio-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libpangocairo-1.0.0.dylib (compatibility version 3401.0.0, current version 3401.0.0)
@executable_path/../Resources/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 2601.0.0, current version 2601.5.0)
@executable_path/../Resources/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.6.0)
@executable_path/../Resources/lib/libpango-1.0.0.dylib (compatibility version 3401.0.0, current version 3401.0.0)
@executable_path/../Resources/lib/libfreetype.6.dylib (compatibility version 16.0.0, current version 16.0.0)
@executable_path/../Resources/lib/libpng15.15.dylib (compatibility version 29.0.0, current version 29.0.0)
@executable_path/../Resources/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
@executable_path/../Resources/lib/libgobject-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
A specific modified GTK2 theme, Lion Gtk Theme, by weakhead, was used to change the appearance of the sw; the content of should contains
gtk-theme-name = "Lion Gtk Theme"
and the theme itself inside
An installer was created with PackageMaker including a postinstall sh-script


mkdir $HOME/.mandelbulber/
cd "$(dirname "$0")"
sudo ditto usr/share/ /usr/share/mandelbulber/

If you are using gcc provided by Apple (it might be gcc 4.2.1) you might change a switch used by to optimize the output of the compiler for your CPU.
in linux is:

-march=native -mfpmath=387,sse -ffast-math
please refer to to change this value according to your specific computer; on this machine is
-m64 -march=core2 -mfpmath=sse -ffast-math
clang++ compiler can be used instead of g++
For OpenCL version, we need to set libraries and headers before launching makefile.Pkg-config's magic always simplify the task of building against GTK+.
export LDFLAGS="-L$HOME/gtk/inst/lib -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries"
export CPPFLAGS="-I$HOME/gtk/inst/include -I/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers"
in OSX, every time we need to call OpenCL (cl.hpp, cl_support.hpp) we need to set specifically

#include <OpenCL/opencl.h>

while in linux is:

#include <CL/opencl.h>

we need to change the content of this way:
LIBS := -framework OpenCL -lgthread-2.0 -lglib-2.0 -lgtk-quartz-2.0 -lgdk-quartz-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lgthread-2.0 -lglib-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lpng -ljpeg -lgobject-2.0

Personal tools
Content Creation
Belgian Spaces