summaryrefslogtreecommitdiff
path: root/doc/api/rendering.texi
blob: d24d7da6b0315cafb7e190754bc1dd0418866ed5 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@node Rendering
@section Rendering

@strong{Sly's rendering engine is very volatile and subject to
frequent changes currently, so the following documentation is both
incomplete and out of date.  Future releases will feature a stable
rendering API.}

Keeping with the theme of declarative and functional code, Sly's
rendering module provide a purely functional interface to the
imperative world of OpenGL.  An abstraction on top of OpenGL known as
``render combinators'' provide a convenient way to describe and
compose rendering pipelines.

@menu
* Render Combinators::          Purely functional rendering API.
* Sprites::                     2D textured rectangles.
* Textures::                    Pixel arrays.
* Fonts::                       Font loading and text rendering.
* Shapes::                      Primitive 2D/3D shapes.
* Cameras::                     Defining a viewpoint.
* Colors::                      Pretty colors.
* Framebuffers::                Offscreen rendering.
* Shaders::                     Programs that run on the GPU.
@end menu

@node Render Combinators
@subsection Render Combinators

Render combinators provide a purely functional interface to the OpenGL
state machine.

@node Sprites
@subsection Sprites

@deffn {Scheme Procedure} make-sprite @var{texture} [#:anchor]
Create a sprite that displays the image in @var{texture}.  The size of
the mesh is the size of @var{texture} in pixels.  @var{anchor} defines
the origin of the sprite.  By default, the anchor is @code{center},
which puts the origin in the middle of the sprite.  See
'anchor-texture' for more anchoring options.
@end deffn

@deffn {Scheme Procedure} load-sprite @var{file} [#:anchor]
Create a sprite from the texture in @var{file} whose origin is defined
by @var{anchor}.  The default anchor is @code{center}.
@end deffn

@deffn {Scheme Syntax} sprite? @var{obj}
Return @code{#t} if @var{obj} is a sprite.
@end deffn

@deffn {Scheme Syntax} sprite-texture @var{sprite}
Return the texture for @var{sprite}.
@end deffn

@deffn {Scheme Syntax} sprite-mesh @var{mesh}
Return the mesh for @var{sprite}.
@end deffn

@deffn {Scheme Procedure} render-sprite @var{sprite}
Create a renderer for @var{sprite}.
@end deffn

@node Textures
@subsection Textures

@node Fonts
@subsection Fonts

@node Shapes
@subsection Shapes

@node Cameras
@subsection Cameras

@node Colors
@subsection Colors

@node Framebuffers
@subsection Framebuffers

@node Shaders
@subsection Shaders