Skip to content

OpenGL GPU rendering of the Mandelbrot Set with 64-bit zoom in Java

Notifications You must be signed in to change notification settings

cianjinks/MandelbrotViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mandelbrot Viewer

Mandelbrot Viewer is a simple application which utilises the GPU via OpenGL to visualize the Mandelbrot Set in real time. The maximum possible zoom is 64-bit due to the limitations of OpenGL Doubles. v1.0 C++ port of this project

I wrote a tutorial series on how to create this project on my blog which can be found here.

A YouTube video demonstrating the project can be viewed here.

Preview

Preview One Preview Two Preview Three

Building

The application can be built with Maven:

mvn clean package

The jar file will be available in the ./target directory.

Controls

W, A, S, D for panning.

Z, X or scroll wheel for zooming in and out.

K to take a screenshot. (Currently Disabled)

Configuration

GUI

The UI allows you to configure the color and precision of the set via a pure 
java binding of ImGUI. The variables it modifies are the uniform variables u_Color
and u_maxIter used in the fragment shader below.

More useful configuration variables:

src/main/java/Application.java

PIXEL_WIDTH & PIXEL_HEIGHT:
- The window's resolution.
WIDTH & HEIGHT:
- The scale of the complex axis (4 would be [-2, 2]).
TITLE:
- The window's title.
BACKGROUND_COLOUR:
- The window's background colour.

src/resources/shaders/frag.shader

This file contains the math for generating the Mandelbrot Set. 
If you wish to change the colours of the set without the UI you should modify the 
colorFunc function.
It takes in the uniform u_maxIter which is the number of iterations it took before 
the modulus of a point on the set became >= 4.

Libraries

  • LWJGL 3 (minimal OpenGL configuration)
  • JOML (math library)
  • Dear ImGUI (pure java binding of the C++ UI library)