Mandelbrot Generation Part 2: Generation Success

Alrighte, it's been two or so days since I've had time to sit down and do any programming at all, as I'm pretty

busy at the moment. We'll see how much I remember what I've been doing. :p
So I left off where I had drawn a 10x10 pixel texture and figured out how to set pixel color-by pixel. So, let's try and port the C++ code that I found into C# and see if it works.

...Well then. That worked really well. Now to find out how the hell it works. XD
I pretty much copied and pasted the code over, so I'm not really sure how it works, so let's go through and add spaces and stuff.

For some reason some people like to do things like this:
int MyVar = x*32+y/12*13

Now, I do this myself every now and then, but I try and go back and fix stuff, so it looks like this:
int MyVar = x * 32 + y / 12 * 13

It just helps reading it so much. Of course that's just me being OCD, but whatever. Visual Studio also does this automatically, which helps a lot.
Of course, the variable names that the guy used don't make that much sense, so let's go study the code a bit.
Okay, then. I don't have that much of an idea what's going on. I'll have to read that web page again and hope that he explains his math. I'd also like to do the nice color thing, and I don't know how off the top of my head, but I do know that guy explains how to do it. For now, I want to try and see if I can do zooming, I'd better be able to figure out how to do that. XD
First step will be to figure out how to do keypresses, a simple search through the documentation finds me that answer:

        static void OnKeyPressed(object sender, KeyEventArgs e)
            RenderWindow window = (RenderWindow)sender;
            if (e.Code == KeyCode.Escape)

Awesome, shouldn't be that hard from here, let's see what variables I can change to change up the zoom.

(Next day)

Okay, yeah..totally didn't have much time to program recently. I did, however, read the webpage again and now I understand much more about what's going on, which is very helpful.
Well, I've made some of the Mandelbrot pretty colors, but not all of it, which kind of bugs me, but whatever.

Here's what I've got so far:

I also can't figure out how to zoom into the fractal at all, which is very annoying. It's probably because I can't figure out how to render different images with SFML, but whatever.
So, yeah. At this point I think I'm going to put this down because I have successfully generated a Mandelbrot fractal, which was what I wanted to do, even if it isn't ask pretty as I'd like, it's still there. I'll probably come back to it later and work on the zooming part, and the colors again, but for now I'm tired of mucking around with stuff I don't understand.


Post a Comment