Since you want to do this efficiently - measure how long each OpenGL call takes. I wouldn't be surprised at all if that takes most of the time. Find out how to store various pixel values int a buffer and draw them with one call.
Measure how much time you actually save by checking that the starting value repeats. I wouldn't be surprised if the amount is negative.
Figure out where the main black blob is and find a formula to check whether a value is inside it. You can also check for the next black circle. If you think that takes too long do the check only if the previous pointer hit maxIter. So if you check points horizontally, you do this check after the first black point until you leave the black area again.
Don't check for escape on every iteration. Do say 8 iterations, then check. If you have escaped, redo the last 8 iterations to find exactly when you escaped. That saves lots of checks and lots of looping.
Use fma()fma()
whenever possible. It is faster and more precise (but not 100% identical, so the compiler doesn't do it automatically). fma (a, b, c) = a*b + cfma(a, b, c) = a * b + c
with a single rounding, and usually takes the same time as the multiplication on its own.
Check which is faster - fabs(x) > 0.75 of xx > 0.750.75fabs(x) > 0.75
or x * x > 0.75 * 0.75
.
Use vector registers to calculate multiple values at the same time. And then try doing two or for sets of points at the same time.
floatfloat
vs doubledouble
: If you use vector registers then floatfloat
is faster BUT floatfloat
isn't every precise. In areas with 200 or 500 iterations, your images will suffer badly.