Skip to content

Commit

Permalink
Correct float vecn uniform types. fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
frzi committed Apr 21, 2017
1 parent c43fc93 commit c6868ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,16 @@ Data can be downloaded to the host and uploaded to the device using the `toHost`

##### new DeviceBuffer({ alloc|data, type, vector })
See `new Buffer()`. Only major difference is that no data is allocated nor referenced on the host.

##### DeviceBuffer.prototype.copy()
Returns a copy of the DeviceBuffer. The data on the device is also copied.

##### DeviceBuffer.prototype.delete()
Delete the data on the device, and, essentially, turn the DeviceBuffer's instance unusable.

##### DeviceBuffer.prototype.toDevice(data)
`data`: A TypedArray (of the same type and size the DeviceBuffer was initialized with) whose data will be uploaded to the device.

##### DeviceBuffer.prototype.toHost([data])
Download the data on the device back to the host.
`data`: (Optional) If given, it should be of the same type and size the DeviceBuffer was initialized with. If not given, __blink.js__ will initialize and return the correct TypedArray.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blink.js",
"version": "0.2.0",
"version": "0.2.1",
"description": "Easy GPGPU on the web, powered by WebGL 2.0.",
"main": "dist/blink.js",
"homepage": "https://github.com/frzi/blinkjs",
Expand Down
6 changes: 3 additions & 3 deletions src/WebGL/Program.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ function compileShader(type, source) {

const uniformsFnTable = {
[gl.FLOAT]: 'uniform1f',
[gl.FLOAT_VEC_2]: 'uniform2f',
[gl.FLOAT_VEC_3]: 'uniform3f',
[gl.FLOAT_VEC_4]: 'uniform4f',
[gl.FLOAT_VEC2]: 'uniform2f',
[gl.FLOAT_VEC3]: 'uniform3f',
[gl.FLOAT_VEC4]: 'uniform4f',
[gl.INT]: 'uniform1i',
[gl.INT_VEC2]: 'uniform2i',
[gl.INT_VEC3]: 'uniform3i',
Expand Down

0 comments on commit c6868ad

Please sign in to comment.