[Pas2js] Random bugs and observations

Ryan Joseph ryan at thealchemistguild.com
Fri May 11 10:52:30 CEST 2018



> On May 11, 2018, at 3:23 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> 
> Yes, but as said, this is probably wrong.
> 
>> gl.bufferData wants TJSBufferSource so shouldn’t Float32Array work? I had this problem other times with other classes. Unless polymorphism doesn’t work the same in JS...
> 
> Do you get a compiler error or a run-time error ?
> 

Compile time.

  gl.bufferData(gl.ARRAY_BUFFER, bytes, gl.STATIC_DRAW);

Incompatible type arg no. 2: Got "TJSFloat32Array", expected “TJSBufferSource"

  gl.bufferData(gl.ARRAY_BUFFER, TJSBufferSource(bytes), gl.STATIC_DRAW);

Incompatible type arg no. 2: Got "TJSBufferSource", expected “TJSBufferSource"

My hack just so I could move on is adding a method to the class manually.

    procedure bufferData_ANY(target : GLenum;  data : JSValue ; usage : GLenum); external name 'bufferData’;

  gl.bufferData_ANY(gl.ARRAY_BUFFER, bytes, gl.STATIC_DRAW);



Regards,
	Ryan Joseph



More information about the Pas2js mailing list