Page 1 of 2

gfxbrot.c and gfxjulia.c

Posted: 12 Sep 2021, 10:35
by veekoo
The idea of drawing fractals grew. First I wanted to do simple julia. Ended up doing it with ascii. Julia can't be done without mandelbrot, so it did ascbrot.c and then ascjulia.c. Now I was suggested to use graphics.
lb3361 wrote: 12 Sep 2021, 03:03 Now with graphics?

Code: Select all

#include <gigatron/console.h>

void drawPixel(int x, int y, int color)
{
    screenMemory[y][x] = color;
}
Note: the code above assumes the screen has not been scrolled -- default videoTable.
Otherwise you can include <gigatron/console.h> and call console_clear_screen(void) to reset it.
All I needed to do minor changes to asc-version to get gfx-version.

Re: gfxbrot.c and gfxjulia.c

Posted: 12 Sep 2021, 11:11
by lb3361
Cool.

I am afraid floating point on the Gigatron is not very fast. This is why official 'Mandelbrot' program uses fixed point. But that makes it very hard to follow. Anyway, thanks for giving such a good test to my floating point runtime.

Re: gfxbrot.c and gfxjulia.c

Posted: 12 Sep 2021, 14:15
by veekoo
Indeed slow stuff - gfxbrot - took 4,5 hours to calculate

Re: gfxbrot.c and gfxjulia.c

Posted: 12 Sep 2021, 14:33
by at67
veekoo wrote: 12 Sep 2021, 14:15 Indeed slow stuff - gfxbrot - took 4,5 hours to calculate
Looks good, try changing modes, (use Mode 3), to get about a 250% speedup compared to mode 0.

P.S. Mandlebrot in gtBASIC ROMvX0 in mode 3 using fixed point and symmetry to cut calculations in half takes just over 60seconds.
FastMandlebrot.JPG
FastMandlebrot.JPG (326.87 KiB) Viewed 6518 times

Re: gfxbrot.c and gfxjulia.c

Posted: 12 Sep 2021, 17:16
by veekoo
gfxjulia - took 3 hours to calculate

I always with these apps use fast mode during calculations and afterwards when viewing the screen I switch to slow mode.
I think using less colors and iterations this could be made faster plus in code there might be something to optimize. Maybe a grey scale version? What color numbers those might be?

Re: gfxbrot.c and gfxjulia.c

Posted: 13 Sep 2021, 11:51
by lb3361
The graphics version has a much smaller gt1 because it doesn't need to link stdio or console support.

Re: gfxbrot.c and gfxjulia.c

Posted: 13 Sep 2021, 12:59
by at67
veekoo wrote: 12 Sep 2021, 17:16 I think using less colors and iterations this could be made faster plus in code there might be something to optimize. Maybe a grey scale version? What color numbers those might be?
Iterations will help with speed but will lose fidelity on the boundaries, (the interesting bits), I use 16 iterations and map those to a LUT filled with 16 interesting colours.

The Gigatron only has 2bits per colour component, (i.e. RGB), so that is a maximum of 4 grey scales, (including black and white). You could use dithering to sacrifice spatial resolution for colour/grey scale resolution and simulate more grey scales, but it would probably look much worse given how big the Gigatron's pixels already are, (only one way to find out though).

Re: gfxbrot.c and gfxjulia.c

Posted: 14 Sep 2021, 19:01
by veekoo
This is current state of coding. Pictures added.

Re: gfxbrot.c and gfxjulia.c

Posted: 17 Sep 2021, 19:00
by veekoo
Latest sources and executables can be found at github:

Re: gfxbrot.c and gfxjulia.c

Posted: 31 Jan 2022, 11:05
by veekoo
Graphics fractal development has gone to solid version (ROMV4). Goal of code is to give full support for standard Gigatron TTL machine with stable rom. I hope many other coders publish some version of their programs for standard machine too. -x (extended) version has more iterations and colors thus longer cakculation time.