Next: , Up: Graphics   [Contents][Index]


2.4.1 Rendering Engine

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 Vertex Arrays) 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.

Scheme Syntax: gpu-apply shader vertex-array [#:uniform-key uniform-value ...]
Scheme Syntax: gpu-apply* shader vertex-array count [#:uniform-key uniform-value ...]

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.

Scheme Procedure: current-viewport

Return the currently bound viewport. See Viewports for more details about using viewports.

Scheme Procedure: current-framebuffer

Return the currently bound framebuffer. See Framebuffers for more details about using framebuffers.

Scheme Procedure: current-blend-mode

Return the currently bound blend mode. See Blending and Depth Testing for more details about using blend modes.

Scheme Procedure: current-depth-test

Return #t if depth testing is currently enabled. See Blending and Depth Testing for more details about using the depth test.

Scheme Procedure: current-texture

Return the currently bound texture. See Textures for more details about using textures.

Scheme Procedure: current-projection

Return the currently bound projection matrix. See Matrices for more details about matrices.

Scheme Syntax: with-viewport viewport body ...

Evaluate body with the current viewport bound to viewport.

Scheme Syntax: with-framebuffer framebuffer body ...

Evaluate body with the current framebuffer bound to framebuffer.

Scheme Syntax: with-blend-mode blend-mode body ...

Evaluate body with the current blend mode bound to blend-mode.

Scheme Syntax: with-depth-test depth-test? body ...

Evaluate body with the depth-test disabled if depth-test? is #f, or enabled otherwise.

Scheme Syntax: with-texture texture body ...

Evaluate body with the current texture bound to texture.

Scheme Syntax: with-projection projection body ...

Evaluate body with the current projection matrix bound to projection.


Next: , Up: Graphics   [Contents][Index]