Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: TB Mandelbrot Time

  1. #11
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by RobbeK View Post
    Sure -- but the timer events where coded by Eros , and the Canvas_Bitmap byRef was new for TB 1.9.10 then.
    You can do what you prefer with the code I write and publish, always.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #12
    Eros, Rob, Peter and John,

    Thanks for the feedback!

    @Peter:

    Your code does run fast. However, the colors don't seem to be correct. Please see the attached snapshots for my TB code and your O2 code. That's because TB arrays are always Option Base 1 and your code seems to use Option Base 0 and thus has the colors shifted up by one. You have to change
    ...
    SetPixel hDC, iX, iY, colors(MIterate(cx, cy) + 1)
    ...
    colors(j * wid + i + 1) = Rgb(r, g, b)
    ...
    colors(MaxIters + 2) = 0
    ...
    
    to
    ...
    SetPixel hDC, iX, iY, colors(MIterate(cx, cy))
    ...
    colors(j * wid + i) = Rgb(r, g, b)
    ...
    colors(MaxIters + 1) = 0
    ...
    
    to have the black spike on the left side of the fractal drawn exactly as TB draws it.

    @John:

    No, it won't be faster in a genuine Windows environment because the code uses an ordinary SetPixel() WinAPI to plot the pixels. Your Toshiba's CPU uses hardware virtualization for GDI calls under Wine so the difference will most probably be undetectable. OTOH plotting would be slower if done in Wine's DirectX or OpenGL (= wrapper around Wine's DirectX) because modern nVidia and ATI drivers and Windows sources are closed and your Linux fellows have so far been unable to crack their hardware acceleration technologies, well, mostly.

    [EDIT]

    @Rob:

    Oh, I forgot to answer your question. FBSL's BASIC has usual "eager" (a.k.a. "inclusive") And and Or as well as their "lazy" (a.k.a. "exclusive", a.k.a. "short-circuited") AndAlso and OrElse equivalents for lazy evaluation.

    FBSL's DynC has naturally lazy && and || logic operators only.
    Attached Images Attached Images
    Last edited by mike lobanovsky; 09-12-2013 at 13:35.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  3. #13
    here is my version in o2 ,it is under second
    Attached Files Attached Files
    Last edited by zlatkoAB; 09-12-2013 at 18:39.

  4. #14
    Something in Freebasic (with Firefly RAD)

    best Rob

    BMP -> Screen with Put command
    (hit Update and then AnimX p.e. -- for a new center point, first button then a mouse-click)
    Attached Files Attached Files

  5. #15
    Thanks Mike,

    I surely will have a look at FBSL -- (it can call functions from DLL's etc... ?)

    best Rob

  6. #16
    Gentlemen,

    Thanks a lot, I admired (and appreciated too) the both fractals!

    Rob, it has kernel32.dll, user32.dll and gdi32.dll always preloaded, so that you can call their API's as if they were part of the language vocabulary. You can also map any other DLL(s) in its (their) entirety with just a single preprocessor directive, #DllImports YourFovorite.dll. And it doesn't use function declarations; call the API's however you wish just stay reasonable not to run into GPF's.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  7. #17
    There's been some interest as to whether I notice that message boxes tend to smear the fractal picture of TB and FBSL Mandelbrots rendered unbuffered directly into the screen window's hDC. Yes, I do but the problem isn't mine.

    Windows system dialogs such as Open/Save dialog boxes, message boxes, etc. are "blocking" which means they suspend main program flow until closed with a button click or canceled. Under Windows XP, all dialog boxes except MessageBox() which the MsgBox() function is built around in both TB and FBSL have a CS_SAVEBITS style. This style gives a window an ability to automatically save its background before it pops up and restore it again after it closes. Since XP message boxes lack this style, an attempt to drag them around an unbuffered window will smear the window while its WM_PAINT message handling is blocked by the message box.

    There are several techniques to bypass the blocking nature of XP message boxes but all of them require message box window subclassing which is by no means simple. Adding such code would bloat the sample whose main goal was not to show the beauty of the fractal but rather yield the relevant benchmark results.

    Vista+ message boxes are more liberal in this regard. Since the overwhelming majority of users are on Windows 7 and up these days, adding special-case message box handling to a sample that exists only here and now would be a plain waste of coding time and effort.
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Example: Section 7.7 (pages 222-224) Explorations with the Mandelbrot Set
    By sblank in forum ThinBASIC programming in OpenGL/TBGL
    Replies: 35
    Last Post: 29-12-2023, 13:23
  2. How to create a csv file with a time format (UTC time) ?
    By stephenjgray in forum thinBasic General
    Replies: 4
    Last Post: 30-05-2013, 09:29
  3. canvas_setpixel (mandelbrot)
    By largo_winch in forum UI (User Interface)
    Replies: 14
    Last Post: 31-10-2011, 17:30
  4. 3D Mandelbrot Set
    By zak in forum General
    Replies: 11
    Last Post: 29-11-2010, 06:40
  5. Benoit Mandelbrot, RIP
    By LanceGary in forum Shout Box Area
    Replies: 6
    Last Post: 05-11-2010, 03:35

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •