Next language feature for pas2js...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Next language feature for pas2js...

Ingemar Ragnemalm

Den 2018-05-01 kl. 09:50, Ryan Joseph [hidden email]

      
On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt [hidden email] 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. And I think "strokeStyle" was spelled "strokeStye". Also added

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

into TJSCanvasRenderingContext2D.

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.

/Ingemar


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Next language feature for pas2js...

Michael Van Canneyt


On Tue, 1 May 2018, Ingemar Ragnemalm wrote:

>
> Den 2018-05-01 kl. 09:50, Ryan Joseph <[hidden email]> wrote:
>>> On Apr 25, 2018, at 9:43 PM, Michael Van Canneyt<[hidden email]>
>>> 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal