Edit :
I now know what was wrong with the code and what was wrong with the scaling and moving and zooming etc..
so finnaly :
(move with 'wasd', zoom in and out with mousewheel, increase iterations with and 'u' and 'j' and increase size with 'y' and 'h')
(improvements ideas?)
oh and OpenGL version : http://glsl.heroku.com/e#4645.2
Mandelbrot fractal maker
Mandelbrot fractal maker
- Attachments
-
- Mandelbrot.love
- (919 Bytes) Downloaded 417 times
Last edited by GijsB on Sat Nov 03, 2012 4:47 pm, edited 4 times in total.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Mandelbrot fractal maker
Can't MainCalculation be defined once, outside of the loops? Adding parameters, I suppose.
When I write def I mean function.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Mandelbrot fractal maker
And it may also not be wise to put that code in love.draw. Instead, use Framebuffers. (Just ask if you need help figuring out how they work. )
Help us help you: attach a .love.
Re: Mandelbrot fractal maker
i understand where those framebuffers are for, but i dont know how to use them 3:
anyway, i speeded up the code :
anyway, i speeded up the code :
- Attachments
-
- Mandelbrot fractal maker.love
- (525 Bytes) Downloaded 593 times
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Mandelbrot fractal maker
You are on the right track.
Look at this:
Do you understand what changes I made?
I'll explain Framebuffers if you are ready for it and can't figure it out on your own (but I think you can).
Look at this:
Code: Select all
function MainCalculation(jx, jy, wx, wy, k)
local tx = wx*wx-(wy*wy+jx)
local ty = 2.0*wx*wy+jy
if tx*tx+ty*ty<=m and k<kt then
return MainCalculation(jx, jy, tx, ty, k + 1)
end
return k
end
for x = 0,size,resolution do
local jx = xmin+x*dx
for y = 0,size,resolution do
local jy = ymin+y*dy
table.insert(pixels,{X = x, Y = y, C = MainCalculation(jx, jy, 0, 0, 0)})
end
end
I'll explain Framebuffers if you are ready for it and can't figure it out on your own (but I think you can).
Help us help you: attach a .love.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Mandelbrot fractal maker
Note that framebuffers are not universally supported (about 81% of us support them, according to this source). I would recommend avoiding them unless you need them, since coding a graceful degradation essentially means twice the work, if not more, for a benefit that about a fifth of the community can never see.GijsB wrote:i understand where those framebuffers are for, but i dont know how to use them 3:
anyway, i speeded up the code :
Kurosuke needs beta testers
Re: Mandelbrot fractal maker
Robin, yes and there awesome
Re: Mandelbrot fractal maker
Very cool (runs much quicker in LoveJIT btw)
Spent a while reading up on it and playing with the code/colours
Also found this which is quite cool:
http://www.youtube.com/watch?v=P3WdnLSI2hs
Spent a while reading up on it and playing with the code/colours
Also found this which is quite cool:
http://www.youtube.com/watch?v=P3WdnLSI2hs
Re: Mandelbrot fractal maker
But does anybody know how to zoom into it xD?
Re: Mandelbrot fractal maker
change xmin/xmax ymin/ymaxGijsB wrote:But does anybody know how to zoom into it xD?
Who is online
Users browsing this forum: Bing [Bot] and 10 guests