[fpc-pascal] Next language feature for pas2js...

Michael Van Canneyt michael at freepascal.org
Tue May 1 11:50:23 CEST 2018



On Tue, 1 May 2018, Ingemar Ragnemalm wrote:

>
> Den 2018-05-01 kl. 09:50, Ryan Joseph <ryan at thealchemistguild.com> wrote:
>>> On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt<michael at freepascal.org> 
>>> wrote:
>>> 
>>> Ah, webgl...
>>> 
>>> I had a look at this some time ago, and got depressed. Quickly closed the 
>>> browser and didn't look back. Same for webaudio:(
>> I’m actually a little curious about this myself because I’ve been using 
>> OpenGL often recently. I’ve seen the Ingemar’s demos but I only slightly 
>> grasp how it’s working.
>> 
>> The wiki says you’re actually parsing the Pascal (not compiling it) and 
>> outputting JavaScript. If that’s the case then how does porting libraries 
>> work in practice? For examples lets say I want to translate a single OpenGL 
>> function, how does that look?
>
> I found it surprisingly easy to import undefined JavaScript functions working 
> from examples in the interfaces. I believe web.pas was particularly useful. I 
> also made some changes in web.pas. Well, why not say what: I made 
> localStorage public instead of private.

It is public ?

> And I think "strokeStyle" was spelled  "strokeStye". Also added

Fixed, rev 82.

>
>     procedure ellipse(x, y, radiusX, radiusY: TCanvasCoordType; rotation, 
> startAngle, endAngle: Real; anticlockwise: Boolean);
>
> into TJSCanvasRenderingContext2D.

I did not add that on purpose, because it is marked experimental in the documentation.

I only add 'stable' calls.

>
> Not that much though.
>
> WebGL is interesting for me, and being an OpenGL expert (teaching it for many 
> years, written two course books on the subject and tons of code), I am happy 
> to contribute any way I can. If nothing else, I can promise some decent 
> demos, and testing of course.

I will see if today I can come up with a basic translation based on the IDL that
Ryan posted. I had webgl for version 1.0 on my wishlist.

I'll get back on that later today, and examples would be *hugely* appreciated.

Michael.


More information about the fpc-pascal mailing list