@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