All I needed to do minor changes to asc-version to get gfx-version.lb3361 wrote: ↑12 Sep 2021, 03:03 Now with graphics?
Note: the code above assumes the screen has not been scrolled -- default videoTable.Code: Select all
#include <gigatron/console.h> void drawPixel(int x, int y, int color) { screenMemory[y][x] = color; }
Otherwise you can include <gigatron/console.h> and call console_clear_screen(void) to reset it.
gfxbrot.c and gfxjulia.c
Forum rules
Be nice. No drama.
Be nice. No drama.
gfxbrot.c and gfxjulia.c
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.
Last edited by veekoo on 22 Nov 2023, 14:05, edited 6 times in total.
Re: gfxbrot.c and gfxjulia.c
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.
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
Indeed slow stuff - gfxbrot - took 4,5 hours to calculate
- Attachments
-
- IMG_0921.jpg (3.02 MiB) Viewed 10832 times
Re: gfxbrot.c and gfxjulia.c
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.
Re: gfxbrot.c and gfxjulia.c
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?
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?
- Attachments
-
- IMG_0923.JPG (2.74 MiB) Viewed 10817 times
Re: gfxbrot.c and gfxjulia.c
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
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
This is current state of coding. Pictures added.
- Attachments
-
- gfxjulia.jpg (35.54 KiB) Viewed 10692 times
-
- gfxbrot.jpg (39.55 KiB) Viewed 10692 times
Re: gfxbrot.c and gfxjulia.c
Latest sources and executables can be found at github:
Last edited by veekoo on 22 Nov 2023, 14:06, edited 1 time in total.
Re: gfxbrot.c and gfxjulia.c
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.
- Attachments
-
- gfxjuliax.jpg (64.3 KiB) Viewed 8123 times
-
- gfxjulia.jpg (44.7 KiB) Viewed 8123 times
-
- gfxbrotx.jpg (49.92 KiB) Viewed 8123 times
-
- gfxbrot.jpg (48.19 KiB) Viewed 8123 times
-
- gfxjuliax.gt1
- (3.92 KiB) Downloaded 491 times
-
- gfxjulia.gt1
- (4.16 KiB) Downloaded 491 times
-
- gfxbrotx.gt1
- (3.97 KiB) Downloaded 509 times
-
- gfxbrot.gt1
- (4.15 KiB) Downloaded 488 times