> On May 1, 2018, at 11:27 AM, Michalis Kamburelis <michalis.ka...@gmail.com> 
> wrote:
> 
> I suspect that we will have a unit like WebGL in pas2js that exposes
> the necessary JS functions for Pascal applications.

Sure but how does the porting process look? I’m reading the wiki and it looks 
like it wraps JavaScript classes by doing stuff like:

TJSFunction = class external name 'Function'(TJSObject)

where “Function” is the JavaScript class name. 

Looking at https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API I see 
WebGLRenderingContext has the entire OpenGL API (I think). Does that mean we 
just do something like:

const
  GLfloat = MAP_TO_SOMETHING; // do we have external consts?

type
  TWebGLRenderingContext = class external name 'WebGLRenderingContext' 
(TJSObject)
    procedure clearColor (red, green, blue, alpha: GLfloat); external name 
'clearColor';
  end;

var
  context:
begin
  context := GetCurrentContext; // 
document.getElementById(‘canvas’).getContext()
  context.clearColor(0, 0, 0, 0);

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to