SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Jim Susinno 2001
glfract v0.2.1
Sat Jan 26 15:41:28 EST 2002
June 2001

GLfract: an OpenGL interface for viewing fractals in 3D.

Purpose

to view Mandelbrot/Julia sets as colored heightmaps. immersion. curiosity.

Installation (skip if you got the Windows zip file):

2 steps of Makefile editing will be necessary:

  1. Open the Makefile with any text editor.
  2. Look for commented(#...) lines giving instructions for architecture-specific compile/link settings. Major targets are Unix/Linux and SGI.

With the Makefile edited, the only necessary installation steps are to type 'make'.

The Makefile includes flags for the following libraries:

  -lXmu  -lXi           (X libraries)
  -lglut -lGLU -lGL     (OpenGL, GLU, Glut )
  -lm                   (math)

Usage: ./glfract [filename optional]

glfract takes {.jsn, .msn} files. These can be found in the Eyefract distribution on freshmeat.net, and some are included in this archive(glfract-?.?.*.tar.gz | winglfract*.zip).

Remember to expand the glut window to a more comfortable size.

Files jacked from David Eyerman's Eyefract:

common.h
state.cpp
state.h
function.h
function.cpp
eyefractfuncs.c

Instructions

The mouse is the main input device. Values can be changed by clicking and holding(dragging) a particular mouse button(left, middle, or right).

The 'escape' key will toggle the OpenGL shell prompt and info screen on and off. The prompt is the black box across the bottom of the screen.

Control-x will update the fractal map, which will take a little bit of time(proportional to your resolution, set with the 'res' command), unless live update is on, set with the 'live' command.

Control-Q and -W will set the three mouse buttons to a set of functions. Q sets for viewing transformations.
W sets for fractal and set transformations.

Commands can also be typed from the keyboard when the shell is active (not case sensitive).

__Commands:__(check glf_keyboard.c)
mouse [button] [int]: assign function to a mouse button, ctrl-{q,w}

are shortcuts for this. load [filename] : loads a file(pwd is current directory) save [filename] : saves the current state to [filename]. yflip [int] : toggles a scale of -1 along y axis height [float] : scales height by input (default 0.1) drawmode [int] : 0=wireframe, 1=polygon, 2=dense wireframe, 3=wirelines(x) //xres [int] - use res
//yres [int] - use res
res [int] : set resolution of fractal map live [int] : controls recalculation of map each display loop 2d [int] : toggles display of 2D preview {0,nonzero} 3d [int] : toggles display of 3D view {0,nonzero} drag [int] : toggles display of drag indicator (crosshair+line) origin [int]: toggles drawing of RGB, XYZ origin colormap [int]: toggles use of colormap maxits [int] : sets maximum hits

reset : fully resets all state variables flat : sets GL_draw mode to Flat shading smooth : sets GL_draw mode to Smooth shading

help
?
quit
exit

The command 'MOUSE' will link a specific variable to a given mouse button. Its usage is MOUSE [lL|mM|rR] [int]. The {lmr} (also case insensitive) represents the right, middle, or left mouse buttons, and the integer is an index for the desired mouse function. The indexed list of functions is displayed in the upper-left corner ot the glfract window, and the current mouse functions are displayed above the command line.

The commands yflip, height, drawmode, xres, yres, res, live, 2d, 3d, drag... all pass the arguments given on the command line to a similarly named state variable.
In the code:

if ( live_update ) { ...
so a zero value will evaluate false, and all non-zero values will be true.

Watch for segfaults on SAVE command.

Version history:

Sat Jan 26 15:41:28 EST 2002
0.2.1 : new mouse handler code

0.2.0: Dave has given me the souped-up C++ version of Eyefract.

        Many things have changed.
        Colormap working.
        Removing old cache hacks in favor of linked list of states.
        Fixed it all up to comply with class State.
0.1.1: Added a more accurate frame rate counter for an underfull frame rate buffer.
        This will aid in gauging the speed of David Eyerman's new Eyefract
        release when it is integrated into glfract.
        Can't figure out why the totals aren't initializing properly - i set them to 
        zero just before glutMainLoop and no dice.
        All is well when i reset them manually with control-f.
        Why can't this happen at init time?
0.1.0: Ported code to Windows, but had to implement all structs
        as classes in MSVC++.  Added SAVE command.
        Code works on Windows.
0.0.9: Tightened up 3d fractal draw loop.
        Made code C-conformant(on Solaris gcc at least), mostly by
        not declaring ints within for loop statements.
        Added colored hashes to mouse vars display to indicate
        mouse function.
0.0.8: 2D preview plane, mouse control of Julia parameters.
        Flat, full commands.  Changes to key handler and display loop.

0.0.7: Colormap, *.jsn file support.
0.0.6: Split glfract.c into files { glfract.c, eyefractcode.h,

         eyefractfuncs.c, glf_display.c, glf_keyboard.c, glf_mouse.c }.
        Added some information to display.  Filled out line drawing
        display by using LINE_LOOP instead of just a line segment.
0.0.5: Allowed for variable resolution of fractal plane, and added the 
        commands XRES [int] and YRES [int] to change it.
        Added height scaling of drawing through command line.
0.0.4: Straightened out the fractal display code.  Added center(x,y)
        and range(delta x, delta y) controls to mouse.  Changed 
        defaults to usable values.
0.0.3:  Added glColor3f statement in main fractal drawing loop for 
        colored display, and global int most_hits for scaling colors
        into range [0,1].
        Made fractal_landscape scalable(at compile time) through
        changing of #define LANDSCAPE_SIZE (noticeable slowdown on
        Sun Ultra 5 at size 200 with fractal creation every display
        loop).
        Fixed the relative scaling of movement with zoom.
0.0.2:  Worked on relative scaling of movement threshold(to account
        for zoom).
0.0.1:  Fractal display in 3D wireframe, customizable mouse input
        hacked from mosh.cpp.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.