I want to create a class named Matrix4 that extends Float32Array. I want to be able to override the Float32Array constructor with a constructor that creates an array of 16 elements (normally I would invoke new Float32Array(16), but now I just want new Matrix4).
// This function should override the Float32Array constructor
// And create a Matrix4 object with the size of 16 elements
var Matrix4 = function() {
Float32Array.call(this, 16);
};
Matrix4.prototype = new Float32Array;
The error I get from this code is:
Constructor Float32Array requires 'new'
[]. Is it possible that error is from somewhere else in your code?