|
Post by matthew on Jan 4, 2018 18:49:03 GMT -5
You can find out more about the Fractal on this Wikipedia page or on Paul Bourke's site here.  Const centerX# = 0.0 Const centerY# = 0.0
Dim zoomFactor# = 0.010
Dim scaledX#, scaledY#, x#, y#, xTemp#, X, Y, currIteration Dim maxIterations = 256 Dim screenWidth = WindowWidth() Dim screenHeight = WindowHeight()
glMatrixMode(GL_PROJECTION) glLoadIdentity () glOrtho(0, screenWidth, screenHeight, 0, -1, 1) glMatrixMode(GL_MODELVIEW) glDisable(GL_DEPTH_TEST) glDrawBuffer(GL_FRONT) glClearColor(0.0, 0.0, 0.0, 0.0) glClear(GL_COLOR_BUFFER_BIT)
For X = 0 to screenWidth
For Y = 0 to screenHeight
currIteration = 0
scaledX# = centerX# + ((X - (screenWidth/2)) * zoomFactor#) scaledY# = centerY# + ((Y - (screenHeight / 2)) * zoomFactor#)
x# = 0.0 y# = 0.0
while (((x# * x#) + (y# * y#)) < 4 and (currIteration < maxIterations)) xTemp# = (x#*x#) - (y#*y#) + scaledX# y# = abs(2*x#*y#) + scaledY# x# = abs(xTemp#) currIteration = currIteration + 1 wend
glBegin(GL_POINTS) glColor3ub(currIteration, currIteration, currIteration) glVertex2f(X+0.5, Y+0.5) glEnd()
Next
glFlush()
Next Beep()
|
|