/buddhabrot-amp

Generate & show buddhabrot using C++ AMP

Primary LanguageC++

buddhabrot-amp

buddhabrot-amp is a buddhabrot generator written in C++. It utilizes C++ AMP for the buddhabrot calculation, Direct3D11/DXGI for presentation to the screen & WIC for writing PNGs.

How to run

  • Clone this repo
  • Open solution using Visual Studio (build & tested with Visual Studio 2017)
  • Build & run via Visual Studio

Main components

BuddhabrotGenerator

This class represents the core logic of generating the buddhabrot. It uses C++ AMP to find complex numbers which escape the Mandelbrot set & mark their path on a "canvas" up until they're considered to have escaped. The canvas that is used to record the paths of these escaping points make up the buddhabrot. We color a point on this canvas brighter/darker based on how many paths hit/did not hit this particular cell/point.

BuddhabrotPresenter

This class simply takes three canvases of equal dimensions for each color (red, green & blue) , puts the three color channels into one texture & finally samples this texture into a DXGI swapchain to be displayed on the screen.

write_png_from_arrays

This function is similar in it's logic to the BuddhabrotPresenter in that it takes 3 canvases, combines them into one image & writes that image out to disk as a PNG file.

External dependencies used

Sample image produced

sample