Pelles C forum

C language => User contributions => Topic started by: TimoVJL on November 23, 2013, 10:35:00 PM

Title: Mandelbrot for PellesC
Post by: TimoVJL on November 23, 2013, 10:35:00 PM
Simple Mandelbrot program for PellesC.

EDIT BugFix, reset mouse LBUTTON in WM_CREATE because Explorer leave's it down when doubleclick program to start.
MandelbrotTest6_WS.zip with system palette and with 64-bit version.
Title: Re: Mandelbrot for PellesC
Post by: Vortex on November 23, 2013, 10:57:29 PM
Great example. Thanks.
Title: Re: Mandelbrot for PellesC
Post by: CLR on November 23, 2013, 11:42:43 PM
Very nice program. Thanks.
Title: Re: Mandelbrot for PellesC
Post by: Bitbeisser on November 25, 2013, 04:32:33 AM
Nice one, thanks!  ;)

Ralf
Title: Re: Mandelbrot for PellesC
Post by: czerny on November 25, 2013, 11:29:53 AM
Nice work! But does not terminate fully (see taskmanager).
Title: Re: Mandelbrot for PellesC
Post by: Bitbeisser on November 25, 2013, 08:45:16 PM
Nice work! But does not terminate fully (see taskmanager).
Not sure what you're seeing but it works just fine for me.
Don't see any remnants in the task manager of either program, neither started through the IDE nor standalone (Windows 7 Ultimate 64bit)...  ???

Ralf
Title: Re: Mandelbrot for PellesC
Post by: jcfuller on November 26, 2013, 12:33:51 AM
Strange happenings here.
If I run from the ide after building it works fine.
If I double click on the exe from explorer I don't see the image unless I move or change the size of the window.
From explorer if I right click the file name and run as administrator it shows the image.

James
Title: Re: Mandelbrot for PellesC
Post by: TimoVJL on November 26, 2013, 08:51:36 AM
That Explorer's "feature" is fixed in MandelbrotTest5.zip ???
Title: Re: Mandelbrot for PellesC
Post by: jj2007 on November 26, 2013, 05:00:26 PM
Works like a charm, ca. 600 ms on my trusty Celeron M :)

For comparison, I've posted a BASIC version in the other forum (http://masm32.com/board/index.php?topic=2598.msg27923#msg27923) ;-)
Title: Re: Mandelbrot for PellesC
Post by: TimoVJL on November 26, 2013, 09:05:37 PM
if one want more speed, lower c to something like 30  ;) as it is now 255.
Title: Re: Mandelbrot for PellesC
Post by: Bitbeisser on November 26, 2013, 10:02:13 PM
if one want more speed, lower c to something like 30  ;) as it is now 255.
Well, once in a while seeing the graph slowly build up can have a soothing effect  8) , but otherwise, the full picture is there as soon as I hit run in the IDE or click on the executable itself. And that's on a fairly old (by today's geek standard) dual core laptop...  ;)

Ralf
Title: Re: Mandelbrot for PellesC
Post by: czerny on November 26, 2013, 10:30:31 PM
Nice work! But does not terminate fully (see taskmanager).
Not sure what you're seeing but it works just fine for me.
Don't see any remnants in the task manager of either program, neither started through the IDE nor standalone (Windows 7 Ultimate 64bit)...  ???
Ralf
I have this under XP. In win2k all is ok! :-)

czerny
Title: Re: Mandelbrot for PellesC
Post by: jj2007 on November 26, 2013, 10:32:15 PM
if one want more speed, lower c to something like 30  ;) as it is now 255.

Yes, that speeds it up a lot. For an equal number of iterations, your version is only 33% slower than hand-crafted assembler - very good, actually.

By the way, I've done some testing of SetDIBitsToDevice vs BitBlt, and it turns out that the latter is over 5% faster.

EDIT: Bad news - #6 doesn't exit properly on Win7-32. It does process the WM_CLOSE message correctly, it passes the WM_DESTROY message and HeapFree succeeds. With PostQuitMessage, it loses 6 handles in TaskManager. Afterwards, Olly reports that the thread ended but Task Manager still sees it, and it must be killed manually...

Attached a version that asks if it should be killed brutally, with ExitProcess. That works but I guess it's not "by design" ;-)
Title: Re: Mandelbrot for PellesC
Post by: TimoVJL on November 27, 2013, 12:06:41 PM
Thank's for reporting that error, i just forgot to use ExitProcess(msg.wParam)

BTW: at start 32-bit 55ms or 64-bit 28 ms   :-\ , timing error  ???

EDIT: MandelbrotTest7_WS_1.zip 60 levels and from 256 colours.
         MandelTestPNG_WS.zip commandline program.