AL_ORTHOGRAPHIC_TRANSFORM(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

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 πŸ¦‹


πŸ’– 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