1al_orthographic_transform(3) al_orthographic_transform(3)
2
3
4
6 al_orthographic_transform - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 void al_orthographic_transform(ALLEGRO_TRANSFORM *trans,
12 float left, float top, float n,
13 float right, float bottom, float f)
14
16 Combines the given transformation with an orthographic transformation
17 which maps the screen rectangle to the given left/top and right/bottom
18 coordinates.
19
20 near/far is the z range, coordinates outside of that range will get
21 clipped. Normally -1/1 is fine because all 2D graphics will have a z
22 coordinate of 0. However if you for example do al_draw_rectangle(0, 0,
23 100, 100) and rotate around the x axis (“towards the screen”) make sure
24 your z range allows values from -100 to 100 or the rotated rectangle
25 will get clipped.
26
27 Also, if you are using a depth buffer the z range decides the depth
28 resolution. For example if you have a 16 bit depth buffer there are
29 only 65536 discrete depth values. So if your near/far is set to
30 -1000000/1000000 most of the z positions would not result in separate
31 depth values which could lead to artifacts.
32
33 The result of applying this transformation to coordinates will be to
34 normalize visible coordinates into the cube from -1/-1/-1 to 1/1/1.
35 Such a transformation is mostly useful for passing it to al_use_projec‐
36 tion_transform(3) - see that function for an example use.
37
39 5.1.3
40
42 al_use_projection_transform(3), al_perspective_transform(3)
43
44
45
46Allegro reference manual al_orthographic_transform(3)