blob: f7cd12beb2c024a14f91e370fd3aaaa860b1605d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
Please see samples/12_c_extensions/01_basics for the overview of C extensions.
This sample reproduces the same program from
samples/07_advanced_rendering/06_pixel_arrays, but moves the creation of the
pixel array to C code.
This particular use-case doesn't need heavier processing power, so you are
only risking problems and portability loss by moving into native code, but
for more computationally demanding jobs, this can be quite helpful: not only
can C crunch numbers and access memory faster, but you can also hand your
pixel array to the renderer without having to convert it to a Ruby array
first (which the engine would then just convert it right back again anyhow).
|