vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.39k stars 67 forks source link

Fix artifacts on resizing #108

Closed Gleefre closed 8 months ago

Gleefre commented 8 months ago

Refactor to reduce code duplication, fix possible flickering / artifacts when resizing / recompiling defsketch.

Note: initialization order was changed: view-matrix and axis-sgn are being set a little bit later; kit.gl.shader:uniform-matrix and gl:viewport are called from kit.sdl2:render method, when the viewport should be updated, which is every time after the initialize-view-matrix function is called. (It is called on the first rendering and then every time width / height / y-axis slots are changed or a :size-changed event is sent)

Also when the :size-changed event is handled the window is immediately re-rendered to avoid flickering too much. (Some flickering is still in place, unfortunately.)

Please review these changes, as I'm not sure it doesn't break anything -- although small tests and examples do run.