Where this guide ends, and what’s next#

This guide covers two dimensions and stops there on purpose. This closing chapter draws the boundary explicitly: where the third dimension continues, what belongs in separate guides, and where the FFI line runs. Naming these keeps you from hunting for coverage that is not here.

The third dimension#

Everything three-dimensional lives in the companion 3D guide. The foundations chapter named the one concept that carries across (the Z-buffer, which decides what is nearest the viewer), and the algorithms chapter noted that tessellation into triangles is the bridge into 3D. The 3D guide picks both up and goes the whole way:

  • The mathematics and the pipeline: vectors, matrices, projection, and a software rasteriser with a real depth buffer, written in plain Perl so every stage is visible.

  • Geometry: meshes, the OBJ, STL, PLY and glTF file formats, modelling operations, and scene graphs with a camera and picking.

  • The GPU, through pperl’s native Peta::WebGPU binding: a window and a frame loop, shaders and buffers, and a lit 3D scene with depth, culling and instancing, plus GPU compute.

  • Three capstones: a world generator, an interactive modeller, and a 3D game, the sequel to this guide’s 2D game.

Deliberately out of scope#

Two areas are excluded on purpose and would each be a separate guide, not a chapter here or in the 3D guide:

  • Computer vision and image analysis. This guide used convolution as a drawing tool (blur, sharpen) and stopped precisely at the line where the same maths becomes detection and recognition. Feature detection, segmentation, and recognition are analysis, not drawing, and belong elsewhere.

  • Hosted image-generation services. Connectors to external image-generation APIs are network and service-integration work, not graphics programming, and are out of scope regardless of dimension.

Where the FFI line runs#

The reaching-further arc was candid at each step about what pperl’s native FFI reaches. Collected here, the line runs like this.

Raw Peta::FFI calls handle scalars, strings, buffers and opaque handles, which is all of a library like Cairo. Beyond those, a struct is a declared record, passed by value or by pointer, a union is declared the same way and passed by pointer, and arrays and out-parameters take a Perl reference. A callback is a real function pointer from closure. The game capstone shows SDL2’s event records, a union, declared that way, so a struct-heavy realtime library is reachable rather than blocked.

All of it is reachable, at a price: nothing is derived from a header. You write each signature from the C prototype and each record’s and union’s members by hand, and a mistake is undefined behaviour rather than a reported error. That is the real cost of a hand-rolled binding, and the reason a native binding is the right unit for anything you intend to keep: it pays the transcription once, in one place, checked once. SDL2 is the worked example. It was written on exactly that pattern and pperl ships it, which is why the capstones call SDL2::Window->new instead of counting struct offsets.

What you can do#

Set against that line, the ground covered is broad. With this guide you can, on pperl:

  • Draw raster images with primitives and filters, and read, scale, and save them (Imager, GD, ImageMagick).

  • Produce resolution-independent vector output, as pixels through Cairo or as markup through SVG (Cairo and SVG).

  • Read and write image metadata, and draw charts (metadata and charts).

  • Open a window, respond to the mouse and keyboard, and animate (windows and the frame loop).

  • Reach a C graphics library through a native binding, with no C compiler and no build step (Cairo showcase).

  • Call a C library through raw FFI, reading its structs back through pointers and handing it callbacks (FFI primer, and the raw layer of the 2D game).

  • Build and run real programs: a drawing application and a 2D game.

That is a complete 2D graphics capability in Perl, from the pixel to a running program. The road out is the 3D guide.