Mandelbrot tutorial?

This is a discussion on Mandelbrot tutorial? within the C Programming forums, part of the General Programming Boards category; I'm getting started on an assignment that uses C and openGL to draw a mandelbrot set. It simply needs to ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    Ghost Planet
    Posts
    7

    Mandelbrot tutorial?

    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!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >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.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    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.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    > 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 dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    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?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    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).
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  7. #7
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286
    Have you tried SDL? I think it is better than OpenGL when it comes to setting single pixels.

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    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.
    Last edited by dwks; 11-07-2006 at 02:05 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 02:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-19-2002, 12:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21