Creating a fractal texture using the compute shader

The Mandelbrot set is based on iterations of the following complex polynomial:

z and c are complex numbers. Starting with the value z = 0 + 0i, we apply the iteration repeatedly until a maximum number of iterations is reached or the value of z exceeds a specified maximum. For a given value of c, if the iteration remains stable (z doesn't increase above the maximum) the point is inside the Mandelbrot set and we color the position corresponding to c black. Otherwise, we color the point based on the number of iterations it took for the value to exceed the maximum.

In the following image, the ...

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.