Category: Graphics Code  ·  Originally posted March 25, 2010  ·  Last updated April 26, 2011

Drawing the Mandelbrot Set / Fractal (in VB6)

One possible view of the Mandelbrot set (generated with this project)

Today’s very cool project demonstrates a proof of concept implementation for rendering the famed Mandelbrot set (or “Mandelbrot fractal”) using VB6.  It’s a bit of a feat, since VB6 isn’t exactly optimized for recursion-heavy calculations…but you know me.  :)  I love making VB do things it was never meant to do!

I’m very happy with how the project turned out.  It may not be the fastest or prettiest or most accurate implementation (for example, at very high zoom-in you’ll start to see noticeable quality degradation), but I’ve deliberately kept the project as short and sweet as possible to maximize adaptability and learning potential.

To enhance the experience, I’ve added several user-controlled options to help you get a feel for how the rendering works.  First is the scroll-bar at the top of the screen, which allows you to preferentially set speed or accuracy as the program’s objective.  (For those familiar with how the Mandelbrot set works, the scroll bar controls the “escape time” of the recursive function.)

Another neat option is a click-and-drag feature that allows you to draw new rendering boundaries.  This makes it simple to zoom as deep as you want into the fractal.

Finally, rather than a drab grayscale rendering, I’ve chosen a more purplish gradient.  The code can be easily modified to favor another color if you so choose.

The code is reasonably optimized, so a complete view should render within several seconds on most modern hardware.  If speed is a concern, note that the white areas of the image take the longest to process – so minimizing the amount of white you select will maximize render speed.  Also, due to the inherent limits of the “Double” type in VB6, if you zoom in really, really far the program may lock up.  (Simply click the close button to force-terminate the project if this happens.)

The download link can be found below these sample images.

This site - and its many free downloads - are funded by donations from visitors like you.
Please consider a small donation to fund server costs and to help me support my family.
Even $1.00 helps. Thank you!

 

bookmark and share this article

Email this article to a friend Print a copy of this article Subscribe to article comments Bookmark this article on Delicious Submit this article to reddit Submit this article to Digg Submit this article to StumbleUpon Share this article on Facebook Tweet this article

related articles

Discussion (2 comments)

Public comments are closed for this article. Private comments may be submitted using this link.
  1. Simply beautiful. Keep it up.

    By bytelogik | April 5, 2010, 3:30 am |
    • Thanks, bytelogik. Looks like you’ve got some equally great graphics work on your own site!   ;)

      By Tanner | April 5, 2010, 3:44 pm |