diff options
Diffstat (limited to 'doc/api.texi')
-rw-r--r-- | doc/api.texi | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/doc/api.texi b/doc/api.texi index 26525f6..8e3ba98 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -2111,20 +2111,20 @@ Within a VBO, one or more ``attributes'', as OpenGL calls them, may be present. Attributes are subregions within the buffer that have a particular data type. In this case, there are two attributes packed into the buffer. To provided a typed view into a buffer, the -@code{make-typed-buffer} procedure is needed: +@code{make-buffer-view} procedure is needed: @example (define vertices - (make-typed-buffer #:buffer buffer - #:type 'vec2 - #:component-type 'float - #:length 4)) + (make-buffer-view #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length 4)) (define texcoords - (make-typed-buffer #:buffer buffer - #:type 'vec2 - #:component-type 'float - #:length 4 - #:offset 8)) + (make-buffer-view #:buffer buffer + #:type 'vec2 + #:component-type 'float + #:length 4 + #:offset 8)) @end example To render a square, the GPU needs to draw two triangles, which means @@ -2139,18 +2139,18 @@ created. (make-buffer (u32vector 0 3 2 0 2 1) #:target 'index) (define indices - (make-typed-buffer #:type 'scalar - #:component-type 'unsigned-int - #:buffer index-buffer)) + (make-buffer-view #:type 'scalar + #:component-type 'unsigned-int + #:buffer index-buffer)) @end example Note the use of the @code{#:target} keyword argument. It is required because the GPU treats index data in a special way and must be told which data is index data. -Now that the typed buffers representing each attribute have been +Now that the buffer views representing each attribute have been created, all that's left is to bind them all together in a ``vertex -array object'', or VAO. Vertex arrays associate each typed buffer +array object'', or VAO. Vertex arrays associate each buffer view with an attribute index on the GPU. The indices that are chosen must correspond with the indices that the shader (@pxref{Shaders}) expects for each attribute. @@ -2267,11 +2267,11 @@ This form is useful for streaming buffers that need to update their contents dynamically, such as a sprite batch. @end deffn -@deffn {Procedure} make-typed-buffer #:buffer #:type @ +@deffn {Procedure} make-buffer-view #:buffer #:type @ #:component-type #:length [#:offset 0] [#:divisor] @ [#:name "anonymous"] -Return a new typed buffer view for @var{buffer} starting at byte index +Return a new buffer view for @var{buffer} starting at byte index @var{offset} of @var{length} elements, where each element is of @var{type} and composed of @var{component-type} values. @@ -2324,37 +2324,37 @@ used for 1 instance. A divisor of 2 means that each element is used for 2 instances, and so on. @end deffn -@deffn {Procedure} typed-buffer? @var{obj} -Return @code{#t} if @var{obj} is a typed buffer. +@deffn {Procedure} buffer-view? @var{obj} +Return @code{#t} if @var{obj} is a buffer view. @end deffn -@deffn {Procedure} typed-buffer->buffer @var{typed-buffer} -Return the buffer that @var{typed-buffer} is using. +@deffn {Procedure} buffer-view->buffer @var{buffer-view} +Return the buffer that @var{buffer-view} is using. @end deffn -@deffn {Procedure} typed-buffer-name @var{typed-buffer} -Return the name of @var{typed-buffer}. +@deffn {Procedure} buffer-view-name @var{buffer-view} +Return the name of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-offset @var{typed-buffer} -Return the byte offset of @var{typed-buffer}. +@deffn {Procedure} buffer-view-offset @var{buffer-view} +Return the byte offset of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-type @var{typed-buffer} -Return the data type of @var{typed-buffer}. +@deffn {Procedure} buffer-view-type @var{buffer-view} +Return the data type of @var{buffer-view}. @end deffn -@deffn {Procedure} typed-buffer-component-type @var{typed-buffer} -Return the component data type of @var{typed-buffer} +@deffn {Procedure} buffer-view-component-type @var{buffer-view} +Return the component data type of @var{buffer-view} @end deffn -@deffn {Procedure} typed-buffer-divisor @var{typed-buffer} -Return the instance divisor for @var{typed-buffer}. +@deffn {Procedure} buffer-view-divisor @var{buffer-view} +Return the instance divisor for @var{buffer-view}. @end deffn -@deffn {Syntax} with-mapped-typed-buffer @var{typed-buffer} @var{body} @dots{} +@deffn {Syntax} with-mapped-buffer-view @var{buffer-view} @var{body} @dots{} -Evaluate @var{body} in the context of @var{typed-buffer} having its +Evaluate @var{body} in the context of @var{buffer-view} having its data synced from GPU memory to RAM. See @code{with-mapped-buffer} for more information. @end deffn @@ -2362,15 +2362,15 @@ more information. @deffn {Procedure} make-vertex-array #:indices #:attributes @ [#:mode @code{triangles}] -Return a new vertex array using the index data within the typed buffer +Return a new vertex array using the index data within the buffer view @var{indices} and the vertex attribute data within @var{attributes}. @var{attributes} is an alist mapping shader attribute indices to typed buffers containing vertex data: @example -`((1 . ,typed-buffer-a) - (2 . ,typed-buffer-b) +`((1 . ,buffer-view-a) + (2 . ,buffer-view-b) ...) @end example @@ -2400,11 +2400,11 @@ Return @code{#t} if @var{obj} is a vertex array. @end deffn @deffn {Procedure} vertex-array-indices @var{vertex-array} -Return the typed buffer containing index data for @var{vertex-array}. +Return the buffer view containing index data for @var{vertex-array}. @end deffn @deffn {Procedure} vertex-array-attributes @var{vertex-array} -Return the attribute index -> typed buffer mapping of vertex attribute +Return the attribute index -> buffer view mapping of vertex attribute data for @var{vertex-array}. @end deffn |