Fantastic program
:
Found a small change in the GL code that that increases the speed quite a lot. Putting the limit test inside the loop will make it drop out after only a few iterations a vast majority of times (it's well worth the extra work when we actually hit something). Then it's possible to reduce the search granularity and still run at a decent frame rate with much greater detail already at the first try.
bool RenderMandelBrot(vec3 avPosition, int alIterations, float afPower)
{
vec3 vTestPos = avPosition;
for(int i=0; i<alIterations; ++i)
{
vTestPos = PolarCoordMulExp(vTestPos,afPower) + avPosition;
if (dot(vTestPos, vTestPos) > 2)
return false;
}
return true;
}
And here's an image from the jungle:
I also tried to increase the number of iterations, but it quickly becomes very grainy and pixelated. I think this is because we reach the limit for the 32-bit float resolution of the GPU. All CPU based programs use 64-bit floats, allowing a lot better resolution. I guess this is what you have to pay for the speed and usability of this program.