File: al_orthographic_transform.3

package info (click to toggle)
allegro5 2%3A5.2.6.0-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 24,212 kB
  • sloc: ansic: 125,319; cpp: 15,781; objc: 4,579; python: 2,802; java: 2,254; javascript: 1,204; sh: 1,002; makefile: 51; perl: 37; xml: 25; pascal: 24
file content (50 lines) | stat: -rw-r--r-- 1,633 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.\" Automatically generated by Pandoc 1.19.2.4
.\"
.TH "al_orthographic_transform" "3" "" "Allegro reference manual" ""
.hy
.SH NAME
.PP
al_orthographic_transform \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

void\ al_orthographic_transform(ALLEGRO_TRANSFORM\ *trans,
\ \ \ float\ left,\ float\ top,\ float\ n,
\ \ \ float\ right,\ float\ bottom,\ float\ f)
\f[]
.fi
.SH DESCRIPTION
.PP
Combines the given transformation with an orthographic transformation
which maps the screen rectangle to the given left/top and right/bottom
coordinates.
.PP
near/far is the z range, coordinates outside of that range will get
clipped.
Normally \-1/1 is fine because all 2D graphics will have a z coordinate
of 0.
However 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.
.PP
Also, if you are 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.
.PP
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.
.SH SINCE
.PP
5.1.3
.SH SEE ALSO
.PP
al_use_projection_transform(3), al_perspective_transform(3)