diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-01-21 19:29:46 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-01-26 17:12:02 -0500 |
commit | aa45ad29efab50318d38bfd096b07021c4c7bde6 (patch) | |
tree | cb4f2347e94aa257a7906945bb5b1c389a22c93b /doc/api.texi | |
parent | 578de9a16d58385f4e9926c7c0effae6127c9270 (diff) |
graphics: Rewrite rendering engine.
Diffstat (limited to 'doc/api.texi')
-rw-r--r-- | doc/api.texi | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/doc/api.texi b/doc/api.texi index 86788ba..13ecc72 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -2926,32 +2926,32 @@ like a procedure for the GPU to apply. Shaders are passed arguments: A vertex array containing the geometry to render (@pxref{Buffers}) and zero or more keyword arguments that the shader understands. Similar to how Scheme has @code{apply} for calling procedures, Chickadee -provides @code{gpu-apply} for calling shaders. +provides @code{shader-apply} for calling shaders. Additionally, there is some dynamic state that effects how -@code{gpu-apply} will behave. Things like the current viewport, +@code{shader-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 -@code{gpu-apply} is called. +@code{shader-apply} is called. The following procedures and syntax can be found in the @code{(chickadee graphics)} module. -@deffn {Syntax} gpu-apply shader vertex-array @ +@deffn {Syntax} shader-apply shader vertex-array @ [#:uniform-key uniform-value @dots{}] -@deffnx {Syntax} gpu-apply* shader vertex-array count @ +@deffnx {Syntax} shader-apply* shader vertex-array count @ [#:uniform-key uniform-value @dots{}] Render @var{vertex-array} using @var{shader} with the uniform values specified in the following keyword arguments. -While @code{gpu-apply} will draw every vertex in @var{vertex-array}, -@code{gpu-apply*} will only draw @var{count} vertices. +While @code{shader-apply} will draw every vertex in @var{vertex-array}, +@code{shader-apply*} will only draw @var{count} vertices. @end deffn -@deffn {Syntax} gpu-apply/instanced shader vertex-array @ +@deffn {Syntax} shader-apply/instanced shader vertex-array @ n [#:uniform-key uniform-value @dots{}] -@deffnx {Syntax} gpu-apply/instanced shader vertex-array @ +@deffnx {Syntax} shader-apply/instanced shader vertex-array @ count n [#:uniform-key uniform-value @dots{}] Render @var{vertex-array} @var{n} times using @var{shader} with the @@ -2961,8 +2961,8 @@ 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 @ref{Particles} use instanced rendering. -While @code{gpu-apply/instanced} will draw every vertex in -@var{vertex-array}, @code{gpu-apply*} will only draw @var{count} +While @code{shader-apply/instanced} will draw every vertex in +@var{vertex-array}, @code{shader-apply*} will only draw @var{count} vertices. @end deffn @@ -3118,7 +3118,7 @@ for each attribute. With the vertex array created, the GPU is now fully aware of how to interpret the data that it has been given in the original buffer. Actually rendering this square is left as an exercise to the reader. -See the @ref{Shaders} section and the @code{gpu-apply} procedure in +See the @ref{Shaders} section and the @code{shader-apply} procedure in @ref{Rendering Engine} for the remaining pieces of a successful draw call. Additionally, consider reading the source code for sprites, shapes, or particles to see GPU buffers in action. @@ -3269,7 +3269,7 @@ Valid values for @var{component-type} are: @end itemize @var{divisor} is only needed for instanced rendering applications (see -@code{gpu-apply/instanced} in @ref{Rendering Engine}) and represents +@code{shader-apply/instanced} in @ref{Rendering Engine}) and represents how many instances each vertex element applies to. A divisor of 0 means that a single element is used for every instance and is used for the data being instanced. A divisor of 1 means that each element is @@ -3427,10 +3427,10 @@ arguments), and some ``uniforms'' (keyword arguments). @example (define my-shader (load-shader "vert.glsl" "frag.glsl")) (define vertices (make-vertex-array @dots{})) -(gpu-apply my-shader vertices #:color red) +(shader-apply my-shader vertices #:color red) @end example -@xref{Rendering Engine} for more details about the @code{gpu-apply} +@xref{Rendering Engine} for more details about the @code{shader-apply} procedure. Shaders are incredibly powerful tools, and there's more information |