Getting black lines in Mandelbrot set plot

Hi everyone! My first post here.

So, I have written my first program using openGL. It plots the Mandelbrot set, and allows you to zoom on a specific region of it by pointing the cursor to it, and pressing z/x to zoom in/out.

The problem is, sometimes I get vertical and/or horizontal black lines all over the plot. Here are some images of it:

http://www.2shared.com/photo/Tre1PRf6/screenshot1.html
http://www.2shared.com/photo/8IDi9DkF/screenshot2.html

And here is the source code of the program: http://pastebin.com/smXvRgfD

I am compiling it under Debian Linux, using gcc with the flags ‘-lGL -lGLU -lglut -lm’.

Am I doing something wrong? Any idea of what is going on is appreciated!

With GL_POINTS, you have to be extremely careful to properly fill a surface without gaps.

You should do a fixed loop on integer values (pixel coordinates), and projects those integer values to the floating point space of the M set.

To get the idea :
gluOrtho2D(0, 0, 320, 240);
for x in 0 to 320
for y in 0 to 240
ehMandel(convertToMandelSpaceX(x),convertToMandelSpaceY(y), &iteractions)

Good idea! I did it, and it seems to me that the lines got a little bit less frequent. But the problem remains…

One weird thing is that, on my laptop (an old Pentium III) no black lines appear, as opposed to here, on a desktop with a better video card (Nvidia Geforce 6200)…

I was thinking that it might be a video card problem, but all 3D applications that require openGL work perfectly!

Using GL_POINTS in this way is both slow and is prone to such problems.

The proper way if you want to do the Mandelbrot calculation on the cpu is to save it to an array and then transfer that data to a texture via glTexSubImage2D, and then rendering it to screen using a quad.

An alternative is to use shaders to render the Mandelbrot fractal directly, it should be a lot faster, though you may loose the ability to use doubles and thus some resolution when zoomed in.