|
Post by tonyweston on May 15, 2006 8:53:35 GMT -5
My Mandelbrot set.....
glMatrixMode (GL_PROJECTION) glLoadIdentity () glOrtho (0, 640, 480, 0, 0, 1) glMatrixMode (GL_MODELVIEW) glDisable(GL_DEPTH_TEST) glClear(GL_COLOR_BUFFER_BIT) glBegin(GL_POINTS)
dim x,y, count, size# dim r#,i#, rtmp#
for x=1 to 640 for y=1 to 480
' itterate count =64 size#=0 r#=0 i#=0 while size#<1 and count>0
rtmp#=r# r#=((r#*r#)-(i#*i#)) + (x-420)/200.0 i#=(2*(rtmp#*i#)) +(y-240)/200.0 size# = r#*i# count=count-1 wend glColor3f(0,count/64.0,0) glVertex2f(x, y)
next SwapBuffers() next
glEnd()
|
|
|
Post by matthew on May 15, 2006 19:01:04 GMT -5
|
|
|
Post by wybiral on May 15, 2006 19:08:10 GMT -5
That is a pretty nifty fractal. Should be blue though... (my favorite color). Thats my only complaint
|
|
|
Post by Centanoul on May 15, 2006 19:59:07 GMT -5
glColor3f(0,count/64.0,count/64.0) Sky-Blue.
glColor3f(0,0,count/64.0) Dark-Blue
|
|
|
Post by tonyweston on May 17, 2006 3:21:49 GMT -5
I didn't even know those pages existed.....One thing I noticed while looking at yours, was that I wasn't working out the 'size' of the Z complex properly.....Which, ended up was causing the strainge patterns around the mandel 'beetle'. My updated code here....though it looks pritty similar to yours glMatrixMode (GL_PROJECTION) glLoadIdentity () glOrtho (0, 640, 480, 0, 0, 1) glMatrixMode (GL_MODELVIEW) glDisable(GL_DEPTH_TEST) glClear(GL_COLOR_BUFFER_BIT) glBegin(GL_POINTS)
dim x,y, count, size# dim r#,i#, rtmp#,rs#,is#
for x=1 to 640 for y=1 to 480
' itterate count =64 size#=0 r#=0 i#=0 while size#<4 and count>0
rtmp#=r# rs#=r#*r# is#=i#*i#
r#=(rs#-is#) + (x-420)/200.0 i#=(2*(rtmp#*i#)) +(y-240)/200.0 size# = rs#+is# count=count-1 wend
glColor3f(0,count/64.0,0) glVertex2f(x, y)
next SwapBuffers() next
glEnd()
|
|
|
Post by matthew on May 17, 2006 5:25:10 GMT -5
|
|
|
Post by matthew on May 17, 2006 5:38:44 GMT -5
More News Tony: The reason why all the Fractals we`ve drawn look alike is that they`re all variations on a constant theme, the Mandelbrot Set. There are other Fractals out there like the Julia Set and the Lyapunov Set, but i haven`t got round to tracking down the Source Code for these yet. You should visit the following Webpage for more Fractal detail. en.wikipedia.org/wiki/Fractal
|
|
|
Post by matthew on May 17, 2006 18:19:50 GMT -5
Hey Tony i`ve rewritten your Fractal, so it now supports multiple screen formats.
' ' Fractal Re-Write by Matthew ' Original Fractal Design By Tony ' ' This Re-Write consists of the following... ' ' 1st. It will now display a Full Size Fractal, for 2 Separate ' Screen Resolutions. ' ' 2nd. The Colour Scheme has been changed. '
glmatrixmode(gl_projection) glloadidentity() glortho (0, windowwidth(), windowheight(), 0, -1, 1) glmatrixmode (gl_modelview) gldisable(gl_depth_test) glclear(gl_depth_buffer_bit or gl_color_buffer_bit)
' '^ Set's up the 2D Screen '
dim x,y, xe, ye, count, size#, sxc#, syc# dim r#,i#, rtmp#,rs#,is#
' '^ Defines the Variables that we will be using ' '^ IMPORTANT NOTE ' '^ "sxc#" and "syc#" are stored as "Real Floating Point Values" '^ If they are stored as Integers the Fractal will not be drawn '^ correctly. '
if windowwidth()=1024 and windowheight()=768 then xe =672 : ye=384 : sxc#=320.0 : syc#=320.0 elseif windowwidth() =640 and windowheight() =480 then xe=420 : ye=240 : sxc#=200.0 : syc#=200.0 endif
' '^ Support for multiple Screen Resolutions '
for x =0 to windowwidth() - 1
for y =0 to windowheight() - 1
count =64 size# =0 r# =0 i# =0
while size# <4 and count >0
rtmp# =r# rs# =r#*r# is# =i#*i# r# =(rs# - is#) + (x - xe) / sxc# i# =(2 * (rtmp# * i#)) + (y - ye) / syc# size# = rs#+is# count=count-1
wend
' '^ Iterate '
glBegin(gl_points) glColor3f(0.0, count/(64.0), 64.0) glVertex2f(x, y) glEnd()
next
Swapbuffers()
next
beep()
|
|