https://github.com/apozzi/mandelbrotexplorer-sdl
An interactive Mandelbrot set explorer, Realtime GPU Powered using SDL and Open CL.
https://github.com/apozzi/mandelbrotexplorer-sdl
madelbrot madelbrotset
Last synced: about 2 months ago
JSON representation
An interactive Mandelbrot set explorer, Realtime GPU Powered using SDL and Open CL.
- Host: GitHub
- URL: https://github.com/apozzi/mandelbrotexplorer-sdl
- Owner: Apozzi
- License: other
- Created: 2020-08-18T19:19:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T12:43:41.000Z (7 months ago)
- Last Synced: 2025-03-22T18:44:59.191Z (7 months ago)
- Topics: madelbrot, madelbrotset
- Language: C++
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MandelbrotExplorer-SDL
An interactive Mandelbrot set explorer, Realtime GPU.
Powered using SDL and OpenCL.View square is resized by scroll, and left click and right click is zoom in and zoom out.

Running in AMD R7 370 Series 4GB.
# This uses GPU processing?
Yes.
This is the Kernel that is send to GPU.
```
__kernel void MandelbrotPixel(__global float* c, __global float* a)
{
unsigned int max = 200;
unsigned int n = get_global_id(0);
float col = n % (int)(floor(a[4]));
float row = (int)(n / (int)(floor(a[4])));
float c_im = 0, c_re = 0;
float x = 0, y = 0;
if (a[5] == 0.0) {
c_im = a[0] - (row * a[2]);
c_re = a[1] + (col * a[3]);
}
if (a[5] == 1.0) {
x = a[6];
y = a[7];
}
int iteration = 0;
while (x*x+y*y <= 4 && iteration < max) {
float x_new = x*x - y*y;
y = 2*x*y + c_im;
x = x_new + c_re;
iteration++;
}
if (iteration > max) {
iteration = 255;
}
c[n] = iteration;
}
```# How compile
With GNU c++ compiler just do.
``` g++ -std=c++11 main.cpp -o mandelbrot -lSDL2_ttf -lSDL2main -lSDL2 -lOpenGL ```
# This tool can be better?
Yes, Basically there is a limitation of the number of decimal places in the float that limits the amount of zoom given in the set, to solve the problem i think of storing information in two variables (which would require a large number of "number tricks" similar to the BigInt and BigFloat libraries ).