Chickadee defines rendering using a metaphor familiar to Scheme
programmers: procedure application. A shader (see Shaders) is
like a procedure for the GPU to apply. Shaders are passed arguments:
A vertex array containing the geometry to render (see Buffers) and
zero or more keyword arguments that the shader understands. Similar
to how Scheme has apply
for calling procedures, Chickadee
provides gpu-apply
for calling shaders.
Additionally, there is some dynamic state that effects how
gpu-apply
will behave. Things like the current viewport,
framebuffer, and blend mode are stored as dynamic state because it
would be tedious to have to have to specify them each time
gpu-apply
is called.
The following procedures and syntax can be found in the
(chickadee render)
module.
Render vertex-array using shader with the uniform values specified in the following keyword arguments.
While gpu-apply
will draw every vertex in vertex-array,
gpu-apply*
will only draw count vertices.
Render vertex-array n times using shader with the uniform values specified in the following keyword arguments.
Instanced rendering is very beneficial for rendering the same object many times with only small differences for each one. For example, the particle effects described in Particles use instanced rendering.
While gpu-apply/instanced
will draw every vertex in
vertex-array, gpu-apply*
will only draw count
vertices.
Return the currently bound viewport (see Viewports).
Return the currently bound framebuffer (see Framebuffers).
Return the currently bound blend mode (see Blending).
Return #t
if depth testing is currently enabled (see Blending).
Return the currently bound texture (see Textures).
Return the currently bound projection matrix (see Matrices).
Evaluate body with the current viewport bound to viewport (see Viewports).
Evaluate body with the current framebuffer bound to framebuffer (see Framebuffers).
Evaluate body with the current blend mode bound to blend-mode (see Blending).
Evaluate body with the depth-test disabled if depth-test?
is #f
, or enabled otherwise (see Blending).
Evaluate body with the current texture bound to texture (see Textures).
Evaluate body with the current projection matrix bound to projection (see Matrices).