What it does
CreateComputeBuffer creates Buffer on a Compute object. It takes elementCount (an integer) and elementType (a string), and answers an integer. That is the first of 2 forms.
Syntax
1
CreateComputeBuffer(elementCount integer, elementType string) → integer2
CreateComputeBuffer(bufferID integer, elementCount integer, elementType string)Parameters
| Name | Type | In forms |
|---|---|---|
| elementCount | integer | all |
| elementType | string | all |
| bufferID | integer | 2 |
What each form returns
| 1 | computeBuffer = CreateComputeBuffer(10, "value") | integer |
| 2 | CreateComputeBuffer(1, 10, "value") | nothing |
Example · generated
Form 1, the command hands back the id
computeBuffer = CreateComputeBuffer(10, "value")DO Sync()LOOPForm 2, you choose the id yourself
CreateComputeBuffer(1, 10, "value")DO Sync()LOOPCreateComputeBuffer is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.