-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the pharo-sdl-experiments wiki.
This repository has a collection of experiments around "layer composition" in Pharo FFI bindings to SDL2 library. The 'SDLExperiments-FFI' package contains improvements to regular Pharo 11's SDL2 bindings.
As a reference, members of "lse-openbloc" mailing-list can read "Tests with SDL2 atlas" thread (beginning of 2023), as well as "Drag and drop between OS windows" thread. Some videos from those threads:
- https://www.youtube.com/watch?v=S9hbx0-SOTg
- https://www.youtube.com/watch?v=t2Csc47EcpE
- https://www.youtube.com/watch?v=kbXim5OY9sQ
- https://www.youtube.com/watch?v=1j-0T3HVcFY
- https://www.youtube.com/watch?v=m0fpCBOM3bU
First, you should use the README's snippet to load the code in a fresh Pharo image. Then follow next subsections.
Browse subclasses of BenchmarkingDemo and evaluate scripts in both instance- and class-side. Open Transcript to check printed benchmark outputs.
In a bash-like command-line, do any of:
SceneDragAndDropDemo: ./pharo Pharo.image eval --no-quit "SceneDragAndDropDemo new open" and draw with your mouse cursor the square from a window to another. They key of this demo is doing a proof-of-concept of custom cursors in a drag&drop scenario between OS windows, multi-platform.

SceneResizingDemo: ./pharo Pharo.image eval --no-quit "SceneResizingDemo new open" and drag the window border.

ScenePositionDemo: ./pharo Pharo.image eval --no-quit "ScenePositionDemo new open" and use the arrow keys and mouse wheel to move the square with sub-pixel precision. There are extra options to start the window with a non-default SDL2 backend, to see variations in your system. The key of this demo is doing a proof-of-concept of how do look of SDL_Textures on sub-pixel copy (it can look bad).

You can use control+q to quit the process.
Evaluate SDL2TextureUpdateBench run and watch output in terminal.
Alternatively you can do it headless, from terminal: ./pharo Pharo.image eval "SDL2TextureUpdateBench run".
The output consists of a table with rows such as this:
opengl STREAM 512.00 MB 4096@4096 sum: 5.85 4.88 32.59 pre: 0.02 0.01 0.06 cairo: 5.82 4.86 32.57 update: 0.01 0.00 0.04
Where:
-
STREAMindicates that theSDL_Texturewas created with as a SDL2 STREAMING texture (it could be STATIC, too) -
sum: 5.85 4.88 32.59corresponds to average, min and max number of milliseconds measured to update aSDL_Texturewith the specified size. The mentioned sum is broken down by the next grouped values (pre,cairoandupdateare the 3 steps to update the texture).
Tip: Follow the instructions in this wiki page to create a vm with other libraries.