title: Coloring mandelbrot set
body: <p>I have came up to something like this:</p>
  
  <pre><code>float MinRe = -2.0f; // real
  float MaxRe = 1.0f;
  float MinIm = -1.0f; // imaginary
  float MaxIm = MinIm + (MaxRe - MinRe) * WindowData.Height / WindowData.Width;
  
  float Re_factor = (MaxRe - MinRe) / (WindowData.Width - 1);
  float Im_factor = (MaxIm - MinIm) / (WindowData.Height - 1);
  
  int MaxIterations = 50;
  int iter=0;
  
  for (int y = 0; y &lt; WindowData.Height; ++y)
  {
      double c_im = MaxIm - y * Im_factor; // complex imaginary
      for (int x = 0; x &lt; WindowData.Width; ++x)
      {
          double c_re = MinRe + x * Re_factor; // complex real
  
          // calculate mandelbrot set
          double Z_re = c_re, Z_im = c_im; // Set Z = c
          bool isInside = true;
  
          for (iter=0; iter &lt; MaxIterations; ++iter)
          {
              double Z_re2 = Z_re * Z_re, Z_im2 = Z_im * Z_im;
              if (Z_re2 + Z_im2 &gt; 4)
              {
                  isInside = false;
                  break;
              }
              Z_im = 2 * Z_re * Z_im + c_im;
              Z_re = Z_re2 - Z_im2 + c_re;
          }
  
          if(isInside) 
          {
              GL.Color3(0, 0, 0);
              GL.Vertex2(x, y);
          }
      }
  }
  </code></pre>
  
  <p>I have tried in few ways, but most of the times ended with single color around set, or whole screen with the same color.</p>
  
  <p>How to set up colors properly?</p>