I'm getting started on an assignment that uses C and openGL to draw a mandelbrot set. It simply needs to draw 1 given set, doesnt have to zoom, or change color over time. Anyone know of any useful links that give a walk through of drawing Mandelbrots/fractals in plain ole C?
I'm familar with the math, so I'm more interested in the learning to draw part.
I've done some googling but everything I've found is in other programming languages.
Any relevent useful links would be appreciated, thanks!
>I'm familar with the math, so I'm more interested in the learning to draw part.
Then your question is about OpenGL and not C. The folks in the Game Programming forum may be able to help you better. We only deal with the C language in this forum.
I'm not sure you will easily find a tuto thou I would take a tutorial about the mathematical function wich generates the fractal and look at some sources like http://3map.snu.ac.kr/course/2000/graphics/mandelbrot.c
Better idea look for lang:"c" mandelbrot in http://www.google.com/codesearch there are many implementations there most of them use opengl.
> I've done some googling but everything I've found is in other programming languages.
Even if it's written is Pascal, you should be able to get the general idea of what's going on.
Being able to look at how solutions are structured in either algorithm terms, or in other languages is an important skill to develop.
If you understand the other programming language, you can "translate" it.
If you can do it with assembly, you are able to reverse engineer - nice, isn't it?
Which part do you not understand? The C code is basically math + static typing + memory @#!% issues + OpenGL, the first three of which you should by now be very familiar with. Although I don't claim to know OpenGL, it should be as basic as filling a display buffer with the generated image and calling some drawing function on that buffer. Generic OpenGL resources and tutorials can be found on the Net in abundance (say, back at home base).
Have you tried SDL? I think it is better than OpenGL when it comes to setting single pixels.
I like the SDL myself, too: http://libsdl.org
It works with Dev-C++ quite well.
If you don't feel like writing graphics functions like line drawing functions or other primitives, you could use SDL_gfx or maybe SGE on top of the SDL.
But if your assignment uses OpenGL, then never mind.