[Pas2js] pas2js Webgl unit committed

Ryan Joseph ryan at thealchemistguild.com
Thu May 10 14:44:06 CEST 2018



> On May 10, 2018, at 7:23 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> 
> {$modeswitch externalclass} 
> 

Thanks, that’s what I was missing.

So back to my array questions now. ;)

v.pos is "array of single” which I’m trying to cast to TJSArray which UInt8Array.set accepts as the first parameter according to the docs but pas2js only accepts a TJSTypedArray and it’s not allowing me to cast to TJSTypedArray. I understand that a JSArray of floats may crash but it should at least compile right? Maybe the method needs an overload so it works with either type?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set

bytes := TJSUInt8Array.new(8); // 2 floats at 4 bytes each
bytes._set(TJSArray(v.pos), 0); // array of single, length 2

Regards,
	Ryan Joseph



More information about the Pas2js mailing list