Skip to content

Commit

Permalink
Change all component offsets to byte offsets to gel with native WebGL…
Browse files Browse the repository at this point in the history
… API better. Update version, docs, and build files.
  • Loading branch information
kbirk committed Apr 4, 2016
1 parent 7207fcf commit 0d8d396
Show file tree
Hide file tree
Showing 38 changed files with 277 additions and 282 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ shader.setUniform( 'uHasTexture', false ); // booleans are converted to float

### Viewports

An `esper.Viewport` defines a rendering resolution and pixel offset within the canvas element. By default, the viewport will be set to the current dimensions of the canvas element with no offset.
An `esper.Viewport` defines a rendering resolution within the canvas element. By default, the viewport will be set to the current dimensions of the canvas element.

```javascript
// Create the viewport.
Expand Down Expand Up @@ -280,7 +280,7 @@ viewport.pop();
### VertexBuffers
An `esper.VertexBuffer` is used to store vertex attribute information. Common attributes include positions, normals, texture coordinates, skeletal animation joint ids and skinning weights. Attributes can be stored in separate isolated buffers or together in a single buffer either accessed at offsets or interleaved with each other to take advantage of cache locality (recommended).
An `esper.VertexBuffer` is used to store vertex attribute information. Common attributes include positions, normals, texture coordinates, skeletal animation joint ids and skinning weights. Attributes can be stored in separate isolated buffers or together in a single buffer either accessed at byte offsets or interleaved with each other to take advantage of cache locality (recommended).
```javascript
// Create separate vertex buffers for each attributes.
Expand Down Expand Up @@ -308,17 +308,17 @@ var vertexBuffer = new esper.VertexBuffer( array, {
0: {
size: 3,
type: 'FLOAT',
offset: 0
byteOffset: 0
},
1: {
size: 3,
type: 'FLOAT',
offset: 12
byteOffset: 12
},
2: {
size: 2,
type: 'FLOAT',
offset: 26
byteOffset: 26
}
);
```
Expand All @@ -334,10 +334,10 @@ vertexBuffer.draw({
mode: TRIANGLES
});

// Draw points from an offset.
// Draw points from a byte offset.
vertexBuffer.draw({
mode: POINTS,
offset: 100
byteOffset: 100 * 4 * 2
});

// Draw n lines.
Expand Down Expand Up @@ -392,7 +392,7 @@ indexBuffer.draw({
// Draw points from an offset.
indexBuffer.draw({
mode: POINTS,
offset: 100
byteOffset: 100 * 4 * 2
});

// Draw n lines.
Expand Down Expand Up @@ -431,7 +431,7 @@ var renderable = new esper.Renderable({
// Draw the renderable.
renderable.draw({
mode: 'LINES', // render lines instead of triangles
offset: 100 * 2, // exclude the first 100 lines
byteOffset: 100 * 4 * 2, // exclude the first 100 lines
count: 500 * 2 // only render 500 lines
});
```
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esper",
"version": "0.8.2",
"version": "0.9.0",
"description": "A low-level WebGL rendering framework",
"homepage": "https://github.com/kbirk/esper",
"authors": [
Expand Down

0 comments on commit 0d8d396

Please sign in to comment.