![]() |
|
speeding up mandelbrot fractal creation |
dougt719
Member #12,931
June 2011
|
I am using Allegro 5 on Ubuntu 14.04. I am creating the Mandelbrot fractal on a 1333 x 1000 display, and a bitmap of the same size. I lock the bitmap, issue 273248 calls to al_put_pixel with color black (background is white), unlock the bitmap, and flip the display. The resulting display is fine, but the timing is not so good compared to SDL2: time on Allegro 5: 3.8 seconds I would appreciate advice on how to speed up the Allegro version, and also can Allegro take advantage of my Nvidia Fermi architecture graphics card? Thanks. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
There are several techniques that allow you to speed up allegro drawing. al_lock_bitmap al_draw_prim al_hold_bitmap_drawing My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
dougt719
Member #12,931
June 2011
|
Thanks for the reply. I am using al_lock_bitmap, and will try the other suggestions soon. |
jmasterx
Member #11,410
October 2009
|
mandelbrot is computed per-pixel, thus a shader would probably be the fastest way. Agui GUI API -> https://github.com/jmasterx/Agui |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
There are two ways to do it using al_lock_bitmap as well. 1. Lock bitmap in desired format 2. Option A. Let allegro draw using al_put_pixel or al_draw_pixel. 2. Option B. Draw directly to the locked bitmap using memory access through locked_region->data. See ALLEGRO_LOCKED_REGION and ALLEGRO_PIXEL_FORMAT. 3. Unlock bitmap My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Bruce Pascoe
Member #15,931
April 2015
![]() |
al_draw_pixel() is generally the faster of the two, I've found. al_draw_prim() is the best option here though. This lets you build up the points in memory and send them to the GPU all at once so the whole thing is blazing fast. Directly working with the screen at the pixel level is a thing of the past. You need different techniques with modern hardware.
|
|