Changeset 31387 in project


Ignore:
Timestamp:
09/11/14 18:32:38 (7 years ago)
Author:
acharlton
Message:

wiki/gl-utils: Update to 0.3.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/gl-utils

    r31368 r31387  
    180180{{ATTRIBUTES}} is a list in the form:
    181181
    182     (NAME TYPE N [normalized: NORMALIZED] [location: LOCATION])
    183 
    184 where {{NAME}} is the attribute name (as a symbol), {{TYPE}} is the type of the attribute as accepted by {{type->gl}}, {{N}} is the number of elements in the attribute, {{NORMALIZED}} is a boolean value indicating whether the attribute’s values should be normalized (defaulting to {{#f}}), and {{LOCATION}} is the shader attribute-location of the attribute (defaulting to -1 and settable by {{mesh-attribute-locations-set!}}).
     182    (NAME TYPE N [normalized: NORMALIZED])
     183
     184where {{NAME}} is the attribute name (as a symbol), {{TYPE}} is the type of the attribute as accepted by {{type->gl}}, {{N}} is the number of elements in the attribute, {{NORMALIZED}} is a boolean value indicating whether the attribute’s values should be normalized (defaulting to {{#f}}).
    185185
    186186{{INITIAL-ELEMENTS}} is either a bytevector or a list of {{(NAME . VALUE)}} pairs where name is the name of the attribute to set (as per the name given in {{ATTRIBUTES}}) and {{VALUE}} is the initial contents of that attribute. When a list is given and more than one attribute is given initial-elements, the {{VALUE}}s should represent the same number of vertices. Values associated with attributes that are {{NORMALIZED}} should be provided as float between {{0.0}} and {{1.0}} (for unsigned types) or {{-1.0}} and {{1.0}}, which are then normalized. If {{INITIAL-ELEMENTS}} is given as a bytevector, that bytevector is used as the entire mesh’s vertex data and {{N-VERTICES}} – the number of vertices – must be provided.
     
    198198The type of record returned by {{make-mesh}}. {{VERTEX-ATTRIBUTES}} is a list of {{vertex-attribute}} records. {{INDEX-TYPE}} is the type given to the {{indices:}} argument of {{make-mesh}}. {{VERTEX-DATA}} and {{INDEX-DATA}} are the bytevectors representing the vertex and index data. {{N-VERTICES}} and {{N-INDICES}} are the number of vertices and indices present in the data. {{VERTEX-BUFFER}}, {{INDEX-BUFFER}} and {{VAO}} are the vertex buffers and VAO created by {{mesh-make-vao!}}. {{STRIDE}} is the number of bytes between the start of consecutive vertices. {{MODE}} is the value of the {{mode:}} argument provided to {{make-mesh}}. {{USAGE}} is the buffer usage that is set with {{make-mesh-vao!}}.
    199199
    200 <record> (vertex-attribute name type number normalized location)</record>
     200<record> (vertex-attribute name type number normalized)</record>
    201201
    202202The type of record returned by {{mesh-vertex-attributes}}. Getters for all of the fields are provided.
    203203
    204 <procedure> (mesh-attribute-locations-set! MESH LOCATIONS)</procedure>
    205 
    206 Set the shader attribute locations of the attributes of {{MESH}}. {{LOCATIONS}} is a list of {{(ATTRIBUTE-NAME . LOCATION)}} pairs.
    207 
    208 <procedure> (mesh-make-vao! MESH [USAGE])</procedure>
    209 
    210 Create a vertex attribute object (VAO) for {{MESH}}. {{USAGE}} is the buffer usage hint keyword as accepted by {{usage->gl}}, defaulting to {{#:static}}. Vertex buffer objects (VBOs) are created for the vertex and index data. The VAO binds these buffers, and sets the vertex attribute pointers. If the usage is one of the static types, the vertex and index data of the mesh are deleted, as are the vertex and index buffers. Attribute locations should be set for the mesh with {{mesh-attribute-locations-set!}} before calling {{mesh-make-vao!}}. The VBOs and VAO created by {{make-mesh-vao!}} are managed and should not be deleted.
     204<procedure> (mesh-make-vao! MESH LOCATIONS [USAGE])</procedure>
     205
     206Create a vertex attribute object (VAO) for {{MESH}}. {{LOCATIONS}} is a list of {{(ATTRIBUTE-NAME . LOCATION)}} pairs. {{USAGE}} is the buffer usage hint keyword as accepted by {{usage->gl}}, defaulting to {{#:static}}. Vertex buffer objects (VBOs) are created for the vertex and index data. The VAO binds these buffers, and sets the vertex attribute pointers of attributes for which locations have been given. If the usage is one of the static types, the vertex and index data of the mesh are deleted, as are the vertex and index buffers. The VBOs and VAO created by {{make-mesh-vao!}} are managed and should not be deleted.
    211207
    212208<procedure> (mesh-vertex-ref MESH ATTRIBUTE VERTEX)</procedure>
     
    404400  (program (make-program (list *vertex* *fragment*)))
    405401
    406   (mesh-attribute-locations-set! rect `((position . ,(gl:get-attrib-location
    407                                                       (program) "position"))
    408                                         (color . ,(gl:get-attrib-location
    409                                                    (program) "color"))))
    410   (mesh-make-vao! rect)
     402  (mesh-make-vao! rect `((position . ,(gl:get-attrib-location
     403                                       (program) "position"))
     404                         (color . ,(gl:get-attrib-location
     405                                    (program) "color"))))
    411406  (let loop ()
    412407    (glfw:swap-buffers (glfw:window))
     
    421416=== Version history
    422417
     418==== Version 0.3.0
     41911 September 2014
     420
     421* Merge {{mesh-attribute-locations-set!}} with {{mesh-make-vao!}}
     422
     423
    423424==== Version 0.2.0
    42442510 September 2014
     
    450451=== License
    451452BSD
    452 
Note: See TracChangeset for help on using the changeset viewer.