Creating the Graphics Layer
View the code: https://github.com/FluxHarmonic/flux-compose
Schedule Change!
Starting next week I'm moving the stream start time forward by one hour.
Streams will now be Tuesday and Thursday, 2PM - 5PM UTC!
Graphics Layer Design
Let's continue with the idea we came up with last time to see how far we can take it:
- Use a retained mode rendering model
- Describe the graphics to be rendered in the Scheme layer
- The C layer will interpret and render the complete scene or instruction list efficiently
- The Scheme layer can replace the graphics instructions at any time (REPL-based "drawing")
- Animations will eventually be possible by describing changes to elements in the scene over time
The goal today is to get some basic things rendering in a preview window and possibly save it out to a .png file.
Tasks
Here's what I'd like to accomplish today:
DONE Rename the project to flux-compose
DONE Get the screen clearing
DONE Find a faster way to iterate on the native layer
DONE Get something simple rendering in the C code
DONE Figure out why init-graphics
is crashing the process, can we come up with a good debugging strategy (running via gdb)
TODO Transmit drawing instructions to renderer thread in some form
TODO Get the basic-gfx.scm
example working
TODO Render the completed image to a .png file
Notes
- https://www.gnu.org/software/guile/manual/html_node/Foreign-Function-Interface.html
- https://www.gnu.org/software/guile/manual/html_node/Foreign-Functions.html
- https://www.gnu.org/software/guile/manual/html_node/Foreign-Structs.html
- https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html
- https://willosborne.co.uk/coding/2019/11/16/iterators-and-for-loops-with-guile-scheme.html
- https://sourceforge.net/p/sdl2gfx/code/HEAD/tree/trunk/SDL2_gfxPrimitives.h
- https://www.ferzkopp.net/Software/SDL2_gfx/Docs/html/_s_d_l2__gfx_primitives_8h.html
- https://www.gnu.org/software/guile/manual/html_node/Coding-With-Keywords.html
The commit for the code from this stream:
https://github.com/FluxHarmonic/flux-compose/commit/4adf5e16fc161f23cc9b95398f006ad6fb97c3c2