[fxtf-drafts] [geometry] WebGL API considerations

trusktr has just created a new issue for https://github.com/w3c/fxtf-drafts:

== [geometry] WebGL API considerations ==
https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-tofloat32array

The following fails,

```js
gl.uniformMatrix4fv(worldMatrixLocation, false, new Float64Array([...]))
```

but the following works,

```js
gl.uniformMatrix4fv(worldMatrixLocation, false, new Float32Array([...]))
```

so then the following will fail

```js
const worldMatrix = new DOMMatrix([...])
gl.uniformMatrix4fv(worldMatrixLocation, false, worldMatrix.toFloat64Array())
```

but the following will work


```js
const worldMatrix = new DOMMatrix([...])
gl.uniformMatrix4fv(worldMatrixLocation, false, worldMatrix.toFloat32Array())
```

For example if it can accept an array,

```js
gl.uniformMatrix4fv(worldMatrixLocation, false, [...])
```

then I don't see a reason for it not to be able to also accept a `Float64Array` and convert it into the format that it needs.

Should we revise some other APIs that would be useful with DOMMatrix to make them easier to work with? Is `[geometry]` is the right place for this question?

Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/195 using your GitHub account

Received on Thursday, 15 June 2017 01:47:33 UTC