AL_ORTHOGRAPHIC_TRANSFORM(3)
okay bestie, welcome to the al_orthographic_transform(3) page from the Library Functions Manual β it's giving Allegro 5 API realness, and we're gonna get you fluent in this transform. π
πΈ NAME πΈ
al_orthographic_transform β Allegro 5 API. That's the whole name-and-one-liner situation. π
β¨ SYNOPSIS β¨
Include this header, then call it like this:
#include <allegro5/allegro.h>
void al_orthographic_transform(ALLEGRO_TRANSFORM *trans,
float left, float top, float n,
float right, float bottom, float f)
π DESCRIPTION π
Okay so this function combines the given transformation with an orthographic transformation that maps the screen rectangle to the left/top and right/bottom coordinates you give it. Slay. π¦
near/far is the z range, and coordinates outside that range will get clipped. Normally -1/1 is fine because all 2D graphics will have a z coordinate of 0. But if you, for example, do al_draw_rectangle(0, 0, 100, 100) and rotate around the x axis (βtowards the screenβ), make sure your z range allows values from -100 to 100 or the rotated rectangle will get clipped. No cap, that clipping is not the vibe. π
Also, if you're using a depth buffer, the z range decides the depth resolution. For example, if you have a 16 bit depth buffer there are only 65536 discrete depth values. So if your near/far is set to -1000000/1000000, most of the z positions would not result in separate depth values, which could lead to artifacts. This is the cautionary tale, bestie. π
The result of applying this transformation to coordinates will be to normalize visible coordinates into the cube from -1/-1/-1 to 1/1/1. Such a transformation is mostly useful for passing it to al_use_projection_transform(3) β see that function for an example use. π
π SINCE π
5.1.3 β periodt, that's when she landed. π
π¦ SEE ALSO π¦
al_use_projection_transform(3)β the function to pass this transform to; it has an example use. πal_perspective_transform(3)β the other transform function on the see-also list. β¨
π from the Allegro reference manual β Allegro 5 API, page al_orthographic_transform(3), SINCE 5.1.3 β no date in the footer, just vibes. Byeeee bestie π«Ά
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms