Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-05

pas2js Webgl unit committed

50 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

See subject. Rev 83 in pas2js subversion.

I have no experience with webgl, so if someone could provide several examples which I can include in the demo folder of pas2js, please post on the pas2js mailing list or send them to me in private.

They would be highly appreciated.

Obviously, if you spot any errors in the import class, please let me know :)

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
Show quoted text 19 lines
On May 1, 2018, at 7:40 PM, Michael Van Canneyt wrote: Hi, See subject. Rev 83 in pas2js subversion. I have no experience with webgl, so if someone could provide several examples which I can include in the demo folder of pas2js, please post on the pas2js mailing list or send them to me in private. They would be highly appreciated. Obviously, if you spot any errors in the import class, please let me know :) Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

How did you end up parsing it?

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 23 lines
> On May 1, 2018, at 7:40 PM, Michael Van Canneyt wrote: > > > Hi, > > See subject. Rev 83 in pas2js subversion. > > I have no experience with webgl, so if someone could provide several > examples which I can include in the demo folder of pas2js, please post on > the pas2js mailing list or send them to me in private. > > They would be highly appreciated. > > Obviously, if you spot any errors in the import class, please let me know :) > > Michael. > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal How did you end up parsing it?

I didn't. Some Regexps in an editor did the job handsomely...

If you want to see some examples of parsers: look at the jsonparser (json parsing), pparser (pascal parsing) and jsparser (Javascript) units. The associted scanner units are really easily understood and resemble each other closely.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
On May 1, 2018, at 7:49 PM, Michael Van Canneyt wrote: I didn't. Some Regexps in an editor did the job handsomely...

By hand. Hardcore. ;)

Because I don’t see it on the wiki can post a minimal example/template of how to get a canvas started?

Basically I want that but it references an HTML file, do we need to make that in addition to the Pascal?

var canvas = document.getElementById('canvas1');
var gl = canvas.getContext('webgl');
canvas.width = newWidth;
canvas.height = newHeight;
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 9 lines
> On May 1, 2018, at 7:49 PM, Michael Van Canneyt wrote: > > I didn't. Some Regexps in an editor did the job handsomely... By hand. Hardcore. ;) Because I don’t see it on the wiki can post a minimal example/template of how to get a canvas started?

Check the canvas demo (demo/rtl/democanvas2d.pas)

Basically I want that but it references an HTML file, do we need to make that in addition to the Pascal?

The "new web project" wizard will make the HTML file for you, if you installed the pas2js_dsgn.lpk package in Lazarus. I think it is available with the distributed latest lazarus, but you should be able to use (I think) the trunk version of the package as well, even in an official lazarus setup.

(Mattias can confirm/deny)

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
[...] The "new web project" wizard will make the HTML file for you, if you installed the pas2js_dsgn.lpk package in Lazarus. I think it is available with the distributed latest lazarus,

No. It was added in 1.9.

Mattias

Reply by email

Ryan Joseph
to Michael Van Canneyt: Check the canvas demo (demo/rtl/democanvas2d.pas) The "new web project" wizard will make…
On May 1, 2018, at 8:28 PM, Michael Van Canneyt wrote: Check the canvas demo (demo/rtl/democanvas2d.pas)

something like this?

var
  canvas: TJSElement; // What type should this be?
  gl: TJSWebGLRenderingContext;
begin
  canvas := document.createElement('canvas');
  document.body.appendChild(canvas);
  gl := canvas.getContext('webgl');
  canvas.width := newWidth;
  canvas.height := newHeight;
  gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);

Not sure about the type which createElement returns that has the getContext method. Do you need document.body.appendChild also? Sorry it’s been a long time since I used JS to do even simple things. Never knew it well.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 15 lines
> On May 1, 2018, at 8:28 PM, Michael Van Canneyt wrote: > > Check the canvas demo (demo/rtl/democanvas2d.pas) something like this? var canvas: TJSElement; // What type should this be? gl: TJSWebGLRenderingContext; begin canvas := document.createElement('canvas'); document.body.appendChild(canvas); gl := canvas.getContext('webgl');
You must do
   gl := TJSWebGLRenderingContext(canvas.getContext('webgl'));

because getContext can return various classes depending on the argument.

Show quoted text 5 lines
canvas.width := newWidth; canvas.height := newHeight; gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); Not sure about the type which createElement returns that has the getContext method.

createElement returns guaranteed TJSElement, but normally it will be TJSHTMLCanvasElement for your call.

So
   canvas: TJSHTMLCanvasElement;
begin
   canvas:=TJSHTMLCanvasElement(document.createElement('canvas'));
Do you need document.body.appendChild also? Sorry it’s been a long time since I used JS to do even simple things. Never knew it well.

Yes, you need that too to insert the new element in the DOM tree.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
Show quoted text 6 lines
On May 1, 2018, at 9:56 PM, Michael Van Canneyt wrote: You must do gl := TJSWebGLRenderingContext(canvas.getContext('webgl')); because getContext can return various classes depending on the argument.

Ok so getContext is method of TJSElement I guess.

Btw I’ve been reading and I don’t see WebGL examples using interlaced vertex data like I suggested in my record question. Rather they all seem to be using different buffer objects for each type of vertex attribute (position, color, texture coord etc…).

Can anyone confirm WebGL just doesn’t support this? OpenGL heavily relies on the idea of pointers with byte offsets but perhaps JavaScript just can’t support that so they opted for 0-offset single type arrays in all cases. That would be too bad though since it makes laying out data more difficult.

Regards,
Ryan Joseph

Reply by email

Michalis Kamburelis
to Ryan Joseph
Ryan Joseph wrote 22 lines
> On May 1, 2018, at 9:56 PM, Michael Van Canneyt wrote: > > You must do > gl := TJSWebGLRenderingContext(canvas.getContext('webgl')); > > because getContext can return various classes depending on the argument. Ok so getContext is method of TJSElement I guess. Btw I’ve been reading and I don’t see WebGL examples using interlaced vertex data like I suggested in my record question. Rather they all seem to be using different buffer objects for each type of vertex attribute (position, color, texture coord etc…). Can anyone confirm WebGL just doesn’t support this? OpenGL heavily relies on the idea of pointers with byte offsets but perhaps JavaScript just can’t support that so they opted for 0-offset single type arrays in all cases. That would be too bad though since it makes laying out data more difficult.

WebGL supports interleaved data, see e.g.
http://learnwebgl.brown37.net/rendering/interleaved_buffers.html .

In general, WebGL is capable of rendering e.g. glTF 2, which allows to use interleaved data in various configurations, PBR etc. So it's quite powerful:)

Many thanks for the WebGL unit! (I will play with it once I catch some breath at other work :) ).

Regards,
Michalis

Reply by email

Michael Van Canneyt
to Ryan Joseph: Ok so getContext is method of TJSElement I guess. Btw I’ve been reading and I don’t…
Ryan Joseph wrote 10 lines
> On May 1, 2018, at 9:56 PM, Michael Van Canneyt wrote: > > You must do > gl := TJSWebGLRenderingContext(canvas.getContext('webgl')); > > because getContext can return various classes depending on the argument. Ok so getContext is method of TJSElement I guess.

Only of the canvas element, I think. Hence my typecast for the canvas element as well.

Show quoted text 11 lines
Btw I’ve been reading and I don’t see WebGL examples using interlaced vertex data like I suggested in my record question. Rather they all seem to be using different buffer objects for each type of vertex attribute (position, color, texture coord etc…). Can anyone confirm WebGL just doesn’t support this? OpenGL heavily relies on the idea of pointers with byte offsets but perhaps JavaScript just can’t support that so they opted for 0-offset single type arrays in all cases. That would be too bad though since it makes laying out data more difficult.

Javascript does not have concepts like offsets, memory buffers and whatnot. These are very low-level concepts, and they do not apply in Javascript. I suspect the WebGL api tries to hide such things from the user.

It's a limited browser environment, running on wildly different platforms, so you cannot expect it to support everything the native environment supports...

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt

So how do you actually build the parser? I downloaded the source but I don’t see a binary.

On Mac cd’ing to the directory and using make gives this error:

/usr/local/bin/ppc386 fpmake.pp -n
Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted
make: *** [fpmake] Error 1

Regards,
Ryan Joseph

Reply by email

Ryan Joseph
to Ryan Joseph
Show quoted text 8 lines
On May 2, 2018, at 8:18 AM, Ryan Joseph wrote: On Mac cd’ing to the directory and using make gives this error: /usr/local/bin/ppc386 fpmake.pp -n Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [fpmake] Error 1

Sorry that was the wrong directory. Root directory gives me this:

Ryans-MacBook-Pro:pas2js ryanjoseph$ make
make: pas2js: Command not found
/usr/local/bin/ppc386 fpmake.pp
Free Pascal Compiler version 3.0.2 [2017/02/12] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Darwin for i386
Compiling fpmake.pp
fpmake.pp(134,15) Error: identifier idents no member "AddLibrary" fpmake.pp(197) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
make: *** [fpmake] Error 1

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 24 lines
> On May 2, 2018, at 8:18 AM, Ryan Joseph wrote: > > On Mac cd’ing to the directory and using make gives this error: > > /usr/local/bin/ppc386 fpmake.pp -n > Fatal: Can't find unit system used by fpmake > Fatal: Compilation aborted > make: *** [fpmake] Error 1 Sorry that was the wrong directory. Root directory gives me this: Ryans-MacBook-Pro:pas2js ryanjoseph$ make make: pas2js: Command not found /usr/local/bin/ppc386 fpmake.pp Free Pascal Compiler version 3.0.2 [2017/02/12] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Darwin for i386 Compiling fpmake.pp fpmake.pp(134,15) Error: identifier idents no member "AddLibrary" fpmake.pp(197) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted make: *** [fpmake] Error 1

It will only work with trunk.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
On May 2, 2018, at 1:24 PM, Michael Van Canneyt wrote: It will only work with trunk.

trunk of what? Do mean the entire fpc sources?

cd /Users/ryanjoseph/Downloads/pas2js
ls
Makefile compiler fpmake.pp utils
Makefile.fpc demo packages

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 7 lines
> On May 2, 2018, at 1:24 PM, Michael Van Canneyt wrote: > > It will only work with trunk. trunk of what? Do mean the entire fpc sources?

Yes. the fpmkunit needs to be the latest version, for the AddLibrary call. I will see if I can work around it.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
On May 2, 2018, at 2:08 PM, Michael Van Canneyt wrote: Yes. the fpmkunit needs to be the latest version, for the AddLibrary call. I will see if I can work around it.

So I need to build the entire compiler and I get pas2js in the end? I didn’t realize it was built on the entire FPC compiler but I guess that makes sense.

Just for fun I made a PHP script to parse that .idl file. :) Not sure if it works on other files but it only took a few hours and seems to work ok. Should be easy to hack with.

https://github.com/genericptr/pas2js-IDL-parser

php pas2js_idl_parser.php /Users/ryanjoseph/Downloads/webgl.idl

========

unit webgl;
{$mode objfpc}
{$modeswitch externalclass}
interface
uses
  JS, Web;
  type GLenum = cardinal;
  type GLboolean = boolean;
  type GLbitfield = cardinal;
  type GLbyte = shortint;
  type GLshort = short;
  type GLint = integer;
  type GLsizei = integer;
  type GLintptr = nativeint;
  type GLsizeiptr = nativeint;
  type GLubyte = byte;
  type GLushort = word;
  type GLuint = cardinal;
  type GLfloat = double;
  type GLclampf = double;
  class TJSWebGLContextAttributes = external name 'WebGLContextAttributes' (TJSObject)
  public
    alpha: GLboolean;
    depth: GLboolean;
    stencil: GLboolean;
    antialias: GLboolean;
    premultipliedAlpha: GLboolean;
    preserveDrawingBuffer: GLboolean;
    powerPreference: WebGLPowerPreference;
    failIfMajorPerformanceCaveat: GLboolean;
  end;
  class TJSWebGLObject = external name 'WebGLObject' (TJSObject);
  class TJSWebGLBuffer = external name 'WebGLBuffer' (TJSWebGLObject);
  class TJSWebGLFramebuffer = external name 'WebGLFramebuffer' (TJSWebGLObject);
  class TJSWebGLProgram = external name 'WebGLProgram' (TJSWebGLObject);
  class TJSWebGLRenderbuffer = external name 'WebGLRenderbuffer' (TJSWebGLObject);
  class TJSWebGLShader = external name 'WebGLShader' (TJSWebGLObject);
  class TJSWebGLTexture = external name 'WebGLTexture' (TJSWebGLObject);
  class TJSWebGLUniformLocation = external name 'WebGLUniformLocation' (TJSObject);
  class TJSWebGLActiveInfo = external name 'WebGLActiveInfo' (TJSObject)
  private
    Fsize: GLint; external name 'size';
    Ftype: GLenum; external name 'type';
    Fname: DOMString; external name 'name';
  public
    property size: GLint read Fsize;
    property type: GLenum read Ftype;
    property name: DOMString read Fname;
  end;
  class TJSWebGLShaderPrecisionFormat = external name 'WebGLShaderPrecisionFormat' (TJSObject)
  private
    FrangeMin: GLint; external name 'rangeMin';
    FrangeMax: GLint; external name 'rangeMax';
    Fprecision: GLint; external name 'precision';
  public
    property rangeMin: GLint read FrangeMin;
    property rangeMax: GLint read FrangeMax;
    property precision: GLint read Fprecision;
  end;
  class TJSWebGLRenderingContextBase = external name 'WebGLRenderingContextBase' (TJSObject)
  private
    Fcanvas: HTMLCanvasElement; external name 'canvas';
    FdrawingBufferWidth: GLsizei; external name 'drawingBufferWidth';
    FdrawingBufferHeight: GLsizei; external name 'drawingBufferHeight';
  public
    const DEPTH_BUFFER_BIT: nativeint;
    const STENCIL_BUFFER_BIT: nativeint;
    const COLOR_BUFFER_BIT: nativeint;
    const POINTS: nativeint;
    const LINES: nativeint;
    const LINE_LOOP: nativeint;
    const LINE_STRIP: nativeint;
    const TRIANGLES: nativeint;
    const TRIANGLE_STRIP: nativeint;
    const TRIANGLE_FAN: nativeint;
    const ZERO: nativeint;
    const ONE: nativeint;
    const SRC_COLOR: nativeint;
    const ONE_MINUS_SRC_COLOR: nativeint;
    const SRC_ALPHA: nativeint;
    const ONE_MINUS_SRC_ALPHA: nativeint;
    const DST_ALPHA: nativeint;
    const ONE_MINUS_DST_ALPHA: nativeint;
    const DST_COLOR: nativeint;
    const ONE_MINUS_DST_COLOR: nativeint;
    const SRC_ALPHA_SATURATE: nativeint;
    const FUNC_ADD: nativeint;
    const BLEND_EQUATION: nativeint;
    const BLEND_EQUATION_RGB: nativeint;
    const BLEND_EQUATION_ALPHA: nativeint;
    const FUNC_SUBTRACT: nativeint;
    const FUNC_REVERSE_SUBTRACT: nativeint;
    const BLEND_DST_RGB: nativeint;
    const BLEND_SRC_RGB: nativeint;
    const BLEND_DST_ALPHA: nativeint;
    const BLEND_SRC_ALPHA: nativeint;
    const CONSTANT_COLOR: nativeint;
    const ONE_MINUS_CONSTANT_COLOR: nativeint;
    const CONSTANT_ALPHA: nativeint;
    const ONE_MINUS_CONSTANT_ALPHA: nativeint;
    const BLEND_COLOR: nativeint;
    const ARRAY_BUFFER: nativeint;
    const ELEMENT_ARRAY_BUFFER: nativeint;
    const ARRAY_BUFFER_BINDING: nativeint;
    const ELEMENT_ARRAY_BUFFER_BINDING: nativeint;
    const STREAM_DRAW: nativeint;
    const STATIC_DRAW: nativeint;
    const DYNAMIC_DRAW: nativeint;
    const BUFFER_SIZE: nativeint;
    const BUFFER_USAGE: nativeint;
    const CURRENT_VERTEX_ATTRIB: nativeint;
    const FRONT: nativeint;
    const BACK: nativeint;
    const FRONT_AND_BACK: nativeint;
    const CULL_FACE: nativeint;
    const BLEND: nativeint;
    const DITHER: nativeint;
    const STENCIL_TEST: nativeint;
    const DEPTH_TEST: nativeint;
    const SCISSOR_TEST: nativeint;
    const POLYGON_OFFSET_FILL: nativeint;
    const SAMPLE_ALPHA_TO_COVERAGE: nativeint;
    const SAMPLE_COVERAGE: nativeint;
    const NO_ERROR: nativeint;
    const INVALID_ENUM: nativeint;
    const INVALID_VALUE: nativeint;
    const INVALID_OPERATION: nativeint;
    const OUT_OF_MEMORY: nativeint;
    const CW: nativeint;
    const CCW: nativeint;
    const LINE_WIDTH: nativeint;
    const ALIASED_POINT_SIZE_RANGE: nativeint;
    const ALIASED_LINE_WIDTH_RANGE: nativeint;
    const CULL_FACE_MODE: nativeint;
    const FRONT_FACE: nativeint;
    const DEPTH_RANGE: nativeint;
    const DEPTH_WRITEMASK: nativeint;
    const DEPTH_CLEAR_VALUE: nativeint;
    const DEPTH_FUNC: nativeint;
    const STENCIL_CLEAR_VALUE: nativeint;
    const STENCIL_FUNC: nativeint;
    const STENCIL_FAIL: nativeint;
    const STENCIL_PASS_DEPTH_FAIL: nativeint;
    const STENCIL_PASS_DEPTH_PASS: nativeint;
    const STENCIL_REF: nativeint;
    const STENCIL_VALUE_MASK: nativeint;
    const STENCIL_WRITEMASK: nativeint;
    const STENCIL_BACK_FUNC: nativeint;
    const STENCIL_BACK_FAIL: nativeint;
    const STENCIL_BACK_PASS_DEPTH_FAIL: nativeint;
    const STENCIL_BACK_PASS_DEPTH_PASS: nativeint;
    const STENCIL_BACK_REF: nativeint;
    const STENCIL_BACK_VALUE_MASK: nativeint;
    const STENCIL_BACK_WRITEMASK: nativeint;
    const VIEWPORT: nativeint;
    const SCISSOR_BOX: nativeint;
    const COLOR_CLEAR_VALUE: nativeint;
    const COLOR_WRITEMASK: nativeint;
    const UNPACK_ALIGNMENT: nativeint;
    const PACK_ALIGNMENT: nativeint;
    const MAX_TEXTURE_SIZE: nativeint;
    const MAX_VIEWPORT_DIMS: nativeint;
    const SUBPIXEL_BITS: nativeint;
    const RED_BITS: nativeint;
    const GREEN_BITS: nativeint;
    const BLUE_BITS: nativeint;
    const ALPHA_BITS: nativeint;
    const DEPTH_BITS: nativeint;
    const STENCIL_BITS: nativeint;
    const POLYGON_OFFSET_UNITS: nativeint;
    const POLYGON_OFFSET_FACTOR: nativeint;
    const TEXTURE_BINDING_2D: nativeint;
    const SAMPLE_BUFFERS: nativeint;
    const SAMPLES: nativeint;
    const SAMPLE_COVERAGE_VALUE: nativeint;
    const SAMPLE_COVERAGE_INVERT: nativeint;
    const COMPRESSED_TEXTURE_FORMATS: nativeint;
    const DONT_CARE: nativeint;
    const FASTEST: nativeint;
    const NICEST: nativeint;
    const GENERATE_MIPMAP_HINT: nativeint;
    const BYTE: nativeint;
    const UNSIGNED_BYTE: nativeint;
    const SHORT: nativeint;
    const UNSIGNED_SHORT: nativeint;
    const INT: nativeint;
    const UNSIGNED_INT: nativeint;
    const FLOAT: nativeint;
    const DEPTH_COMPONENT: nativeint;
    const ALPHA: nativeint;
    const RGB: nativeint;
    const RGBA: nativeint;
    const LUMINANCE: nativeint;
    const LUMINANCE_ALPHA: nativeint;
    const UNSIGNED_SHORT_4_4_4_4: nativeint;
    const UNSIGNED_SHORT_5_5_5_1: nativeint;
    const UNSIGNED_SHORT_5_6_5: nativeint;
    const FRAGMENT_SHADER: nativeint;
    const VERTEX_SHADER: nativeint;
    const MAX_VERTEX_ATTRIBS: nativeint;
    const MAX_VERTEX_UNIFORM_VECTORS: nativeint;
    const MAX_VARYING_VECTORS: nativeint;
    const MAX_COMBINED_TEXTURE_IMAGE_UNITS: nativeint;
    const MAX_VERTEX_TEXTURE_IMAGE_UNITS: nativeint;
    const MAX_TEXTURE_IMAGE_UNITS: nativeint;
    const MAX_FRAGMENT_UNIFORM_VECTORS: nativeint;
    const SHADER_TYPE: nativeint;
    const DELETE_STATUS: nativeint;
    const LINK_STATUS: nativeint;
    const VALIDATE_STATUS: nativeint;
    const ATTACHED_SHADERS: nativeint;
    const ACTIVE_UNIFORMS: nativeint;
    const ACTIVE_ATTRIBUTES: nativeint;
    const SHADING_LANGUAGE_VERSION: nativeint;
    const CURRENT_PROGRAM: nativeint;
    const NEVER: nativeint;
    const LESS: nativeint;
    const EQUAL: nativeint;
    const LEQUAL: nativeint;
    const GREATER: nativeint;
    const NOTEQUAL: nativeint;
    const GEQUAL: nativeint;
    const ALWAYS: nativeint;
    const KEEP: nativeint;
    const REPLACE: nativeint;
    const INCR: nativeint;
    const DECR: nativeint;
    const INVERT: nativeint;
    const INCR_WRAP: nativeint;
    const DECR_WRAP: nativeint;
    const VENDOR: nativeint;
    const RENDERER: nativeint;
    const VERSION: nativeint;
    const NEAREST: nativeint;
    const LINEAR: nativeint;
    const NEAREST_MIPMAP_NEAREST: nativeint;
    const LINEAR_MIPMAP_NEAREST: nativeint;
    const NEAREST_MIPMAP_LINEAR: nativeint;
    const LINEAR_MIPMAP_LINEAR: nativeint;
    const TEXTURE_MAG_FILTER: nativeint;
    const TEXTURE_MIN_FILTER: nativeint;
    const TEXTURE_WRAP_S: nativeint;
    const TEXTURE_WRAP_T: nativeint;
    const TEXTURE_2D: nativeint;
    const TEXTURE: nativeint;
    const TEXTURE_CUBE_MAP: nativeint;
    const TEXTURE_BINDING_CUBE_MAP: nativeint;
    const TEXTURE_CUBE_MAP_POSITIVE_X: nativeint;
    const TEXTURE_CUBE_MAP_NEGATIVE_X: nativeint;
    const TEXTURE_CUBE_MAP_POSITIVE_Y: nativeint;
    const TEXTURE_CUBE_MAP_NEGATIVE_Y: nativeint;
    const TEXTURE_CUBE_MAP_POSITIVE_Z: nativeint;
    const TEXTURE_CUBE_MAP_NEGATIVE_Z: nativeint;
    const MAX_CUBE_MAP_TEXTURE_SIZE: nativeint;
    const TEXTURE0: nativeint;
    const TEXTURE1: nativeint;
    const TEXTURE2: nativeint;
    const TEXTURE3: nativeint;
    const TEXTURE4: nativeint;
    const TEXTURE5: nativeint;
    const TEXTURE6: nativeint;
    const TEXTURE7: nativeint;
    const TEXTURE8: nativeint;
    const TEXTURE9: nativeint;
    const TEXTURE10: nativeint;
    const TEXTURE11: nativeint;
    const TEXTURE12: nativeint;
    const TEXTURE13: nativeint;
    const TEXTURE14: nativeint;
    const TEXTURE15: nativeint;
    const TEXTURE16: nativeint;
    const TEXTURE17: nativeint;
    const TEXTURE18: nativeint;
    const TEXTURE19: nativeint;
    const TEXTURE20: nativeint;
    const TEXTURE21: nativeint;
    const TEXTURE22: nativeint;
    const TEXTURE23: nativeint;
    const TEXTURE24: nativeint;
    const TEXTURE25: nativeint;
    const TEXTURE26: nativeint;
    const TEXTURE27: nativeint;
    const TEXTURE28: nativeint;
    const TEXTURE29: nativeint;
    const TEXTURE30: nativeint;
    const TEXTURE31: nativeint;
    const ACTIVE_TEXTURE: nativeint;
    const REPEAT: nativeint;
    const CLAMP_TO_EDGE: nativeint;
    const MIRRORED_REPEAT: nativeint;
    const FLOAT_VEC2: nativeint;
    const FLOAT_VEC3: nativeint;
    const FLOAT_VEC4: nativeint;
    const INT_VEC2: nativeint;
    const INT_VEC3: nativeint;
    const INT_VEC4: nativeint;
    const BOOL: nativeint;
    const BOOL_VEC2: nativeint;
    const BOOL_VEC3: nativeint;
    const BOOL_VEC4: nativeint;
    const FLOAT_MAT2: nativeint;
    const FLOAT_MAT3: nativeint;
    const FLOAT_MAT4: nativeint;
    const SAMPLER_2D: nativeint;
    const SAMPLER_CUBE: nativeint;
    const VERTEX_ATTRIB_ARRAY_ENABLED: nativeint;
    const VERTEX_ATTRIB_ARRAY_SIZE: nativeint;
    const VERTEX_ATTRIB_ARRAY_STRIDE: nativeint;
    const VERTEX_ATTRIB_ARRAY_TYPE: nativeint;
    const VERTEX_ATTRIB_ARRAY_NORMALIZED: nativeint;
    const VERTEX_ATTRIB_ARRAY_POINTER: nativeint;
    const VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: nativeint;
    const IMPLEMENTATION_COLOR_READ_TYPE: nativeint;
    const IMPLEMENTATION_COLOR_READ_FORMAT: nativeint;
    const COMPILE_STATUS: nativeint;
    const LOW_FLOAT: nativeint;
    const MEDIUM_FLOAT: nativeint;
    const HIGH_FLOAT: nativeint;
    const LOW_INT: nativeint;
    const MEDIUM_INT: nativeint;
    const HIGH_INT: nativeint;
    const FRAMEBUFFER: nativeint;
    const RENDERBUFFER: nativeint;
    const RGBA4: nativeint;
    const RGB5_A1: nativeint;
    const RGB565: nativeint;
    const DEPTH_COMPONENT16: nativeint;
    const STENCIL_INDEX8: nativeint;
    const DEPTH_STENCIL: nativeint;
    const RENDERBUFFER_WIDTH: nativeint;
    const RENDERBUFFER_HEIGHT: nativeint;
    const RENDERBUFFER_INTERNAL_FORMAT: nativeint;
    const RENDERBUFFER_RED_SIZE: nativeint;
    const RENDERBUFFER_GREEN_SIZE: nativeint;
    const RENDERBUFFER_BLUE_SIZE: nativeint;
    const RENDERBUFFER_ALPHA_SIZE: nativeint;
    const RENDERBUFFER_DEPTH_SIZE: nativeint;
    const RENDERBUFFER_STENCIL_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: nativeint;
    const FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: nativeint;
    const FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: nativeint;
    const COLOR_ATTACHMENT0: nativeint;
    const DEPTH_ATTACHMENT: nativeint;
    const STENCIL_ATTACHMENT: nativeint;
    const DEPTH_STENCIL_ATTACHMENT: nativeint;
    const NONE: nativeint;
    const FRAMEBUFFER_COMPLETE: nativeint;
    const FRAMEBUFFER_INCOMPLETE_ATTACHMENT: nativeint;
    const FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: nativeint;
    const FRAMEBUFFER_INCOMPLETE_DIMENSIONS: nativeint;
    const FRAMEBUFFER_UNSUPPORTED: nativeint;
    const FRAMEBUFFER_BINDING: nativeint;
    const RENDERBUFFER_BINDING: nativeint;
    const MAX_RENDERBUFFER_SIZE: nativeint;
    const INVALID_FRAMEBUFFER_OPERATION: nativeint;
    const UNPACK_FLIP_Y_WEBGL: nativeint;
    const UNPACK_PREMULTIPLY_ALPHA_WEBGL: nativeint;
    const CONTEXT_LOST_WEBGL: nativeint;
    const UNPACK_COLORSPACE_CONVERSION_WEBGL: nativeint;
    const BROWSER_DEFAULT_WEBGL: nativeint;
    property canvas: HTMLCanvasElement read Fcanvas;
    property drawingBufferWidth: GLsizei read FdrawingBufferWidth;
    property drawingBufferHeight: GLsizei read FdrawingBufferHeight;
    function getContextAttributes: TJSWebGLContextAttributes;
    function isContextLost: boolean;
    function getSupportedExtensions: DOMStringDynArray;
    function getExtension (name: DOMString): TJSobject;
    procedure activeTexture (texture: GLenum);
    procedure attachShader (program: WebGLProgram; shader: WebGLShader);
    procedure bindAttribLocation (program: WebGLProgram; index: GLuint; name: DOMString);
    procedure bindBuffer (target: GLenum; buffer: TJSWebGLBuffer);
    procedure bindFramebuffer (target: GLenum; framebuffer: TJSWebGLFramebuffer);
    procedure bindRenderbuffer (target: GLenum; renderbuffer: TJSWebGLRenderbuffer);
    procedure bindTexture (target: GLenum; texture: TJSWebGLTexture);
    procedure blendColor (red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf);
    procedure blendEquation (mode: GLenum);
    procedure blendEquationSeparate (modeRGB: GLenum; modeAlpha: GLenum);
    procedure blendFunc (sfactor: GLenum; dfactor: GLenum);
    procedure bufferData (target: GLenum; size: GLsizeiptr; usage: GLenum);
    procedure bufferData (target: GLenum; data: BufferSource; usage: GLenum);
    procedure bufferSubData (target: GLenum; offset: GLintptr; data: BufferSource);
    function checkFramebufferStatus (target: GLenum): GLenum;
    procedure clear (mask: GLbitfield);
    procedure clearColor (red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf);
    procedure clearDepth (depth: GLclampf);
    procedure clearStencil (s: GLint);
    procedure colorMask (red: GLboolean; green: GLboolean; blue: GLboolean; alpha: GLboolean);
    procedure compileShader (shader: WebGLShader);
    function createBuffer: TJSWebGLBuffer;
    function createFramebuffer: TJSWebGLFramebuffer;
    function createProgram: TJSWebGLProgram;
    function createRenderbuffer: TJSWebGLRenderbuffer;
    function createShader (type: GLenum): TJSWebGLShader;
    function createTexture: TJSWebGLTexture;
    procedure cullFace (mode: GLenum);
    procedure deleteBuffer (buffer: TJSWebGLBuffer);
    procedure deleteFramebuffer (framebuffer: TJSWebGLFramebuffer);
    procedure deleteProgram (program: TJSWebGLProgram);
    procedure deleteRenderbuffer (renderbuffer: TJSWebGLRenderbuffer);
    procedure deleteShader (shader: TJSWebGLShader);
    procedure deleteTexture (texture: TJSWebGLTexture);
    procedure depthFunc (func: GLenum);
    procedure depthMask (flag: GLboolean);
    procedure depthRange (zNear: GLclampf; zFar: GLclampf);
    procedure detachShader (program: WebGLProgram; shader: WebGLShader);
    procedure disable (cap: GLenum);
    procedure disableVertexAttribArray (index: GLuint);
    procedure drawArrays (mode: GLenum; first: GLint; count: GLsizei);
    procedure drawElements (mode: GLenum; count: GLsizei; type: GLenum; offset: GLintptr);
    procedure enable (cap: GLenum);
    procedure enableVertexAttribArray (index: GLuint);
    procedure finish;
    procedure flush;
    procedure frontFace (mode: GLenum);
    procedure generateMipmap (target: GLenum);
    function getActiveAttrib (program: WebGLProgram; index: GLuint): TJSWebGLActiveInfo;
    function getActiveUniform (program: WebGLProgram; index: GLuint): TJSWebGLActiveInfo;
    function getAttachedShaders (program: WebGLProgram): WebGLShaderDynArray;
    function getAttribLocation (program: WebGLProgram; name: DOMString): GLint;
    function getBufferParameter (target: GLenum; pname: GLenum): JSValue;
    function getParameter (pname: GLenum): JSValue;
    function getError: GLenum;
    function getProgramParameter (program: WebGLProgram; pname: GLenum): JSValue;
    function getProgramInfoLog (program: WebGLProgram): TJSDOMString;
    function getRenderbufferParameter (target: GLenum; pname: GLenum): JSValue;
    function getShaderParameter (shader: WebGLShader; pname: GLenum): JSValue;
    function getShaderPrecisionFormat (shadertype: GLenum; precisiontype: GLenum): TJSWebGLShaderPrecisionFormat;
    function getShaderInfoLog (shader: WebGLShader): TJSDOMString;
    function getShaderSource (shader: WebGLShader): TJSDOMString;
    function getTexParameter (target: GLenum; pname: GLenum): JSValue;
    function getUniform (program: WebGLProgram; location: WebGLUniformLocation): JSValue;
    function getUniformLocation (program: WebGLProgram; name: DOMString): TJSWebGLUniformLocation;
    function getVertexAttrib (index: GLuint; pname: GLenum): JSValue;
    function getVertexAttribOffset (index: GLuint; pname: GLenum): GLintptr;
    procedure hint (target: GLenum; mode: GLenum);
    function isBuffer (buffer: TJSWebGLBuffer): GLboolean;
    function isEnabled (cap: GLenum): GLboolean;
    function isFramebuffer (framebuffer: TJSWebGLFramebuffer): GLboolean;
    function isProgram (program: TJSWebGLProgram): GLboolean;
    function isRenderbuffer (renderbuffer: TJSWebGLRenderbuffer): GLboolean;
    function isShader (shader: TJSWebGLShader): GLboolean;
    function isTexture (texture: TJSWebGLTexture): GLboolean;
    procedure lineWidth (width: GLfloat);
    procedure linkProgram (program: WebGLProgram);
    procedure pixelStorei (pname: GLenum; param: GLint);
    procedure polygonOffset (factor: GLfloat; units: GLfloat);
    procedure sampleCoverage (value: GLclampf; invert: GLboolean);
    procedure scissor (x: GLint; y: GLint; width: GLsizei; height: GLsizei);
    procedure shaderSource (shader: WebGLShader; source: DOMString);
    procedure stencilFunc (func: GLenum; ref: GLint; mask: GLuint);
    procedure stencilFuncSeparate (face: GLenum; func: GLenum; ref: GLint; mask: GLuint);
    procedure stencilMask (mask: GLuint);
    procedure stencilMaskSeparate (face: GLenum; mask: GLuint);
    procedure stencilOp (fail: GLenum; zfail: GLenum; zpass: GLenum);
    procedure stencilOpSeparate (face: GLenum; fail: GLenum; zfail: GLenum; zpass: GLenum);
    procedure texParameterf (target: GLenum; pname: GLenum; param: GLfloat);
    procedure texParameteri (target: GLenum; pname: GLenum; param: GLint);
    procedure uniform1f (location: TJSWebGLUniformLocation; x: GLfloat);
    procedure uniform2f (location: TJSWebGLUniformLocation; x: GLfloat; y: GLfloat);
    procedure uniform3f (location: TJSWebGLUniformLocation; x: GLfloat; y: GLfloat; z: GLfloat);
    procedure uniform4f (location: TJSWebGLUniformLocation; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat);
    procedure uniform1i (location: TJSWebGLUniformLocation; x: GLint);
    procedure uniform2i (location: TJSWebGLUniformLocation; x: GLint; y: GLint);
    procedure uniform3i (location: TJSWebGLUniformLocation; x: GLint; y: GLint; z: GLint);
    procedure uniform4i (location: TJSWebGLUniformLocation; x: GLint; y: GLint; z: GLint; w: GLint);
    procedure uniform1fv (location: TJSWebGLUniformLocation; v: Float32List);
    procedure uniform2fv (location: TJSWebGLUniformLocation; v: Float32List);
    procedure uniform3fv (location: TJSWebGLUniformLocation; v: Float32List);
    procedure uniform4fv (location: TJSWebGLUniformLocation; v: Float32List);
    procedure uniform1iv (location: TJSWebGLUniformLocation; v: Int32List);
    procedure uniform2iv (location: TJSWebGLUniformLocation; v: Int32List);
    procedure uniform3iv (location: TJSWebGLUniformLocation; v: Int32List);
    procedure uniform4iv (location: TJSWebGLUniformLocation; v: Int32List);
    procedure uniformMatrix2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; value: Float32List);
    procedure uniformMatrix3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; value: Float32List);
    procedure uniformMatrix4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; value: Float32List);
    procedure useProgram (program: TJSWebGLProgram);
    procedure validateProgram (program: WebGLProgram);
    procedure vertexAttrib1f (index: GLuint; x: GLfloat);
    procedure vertexAttrib2f (index: GLuint; x: GLfloat; y: GLfloat);
    procedure vertexAttrib3f (index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat);
    procedure vertexAttrib4f (index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat);
    procedure vertexAttrib1fv (index: GLuint; values: Float32List);
    procedure vertexAttrib2fv (index: GLuint; values: Float32List);
    procedure vertexAttrib3fv (index: GLuint; values: Float32List);
    procedure vertexAttrib4fv (index: GLuint; values: Float32List);
    procedure viewport (x: GLint; y: GLint; width: GLsizei; height: GLsizei);
  end;
  class TJSWebGLRenderingContext = external name 'WebGLRenderingContext' (TJSWebGLRenderingContextBase);
  class TJSWebGLContextEvent = external name 'WebGLContextEvent' (TJSEvent)
  private
    FstatusMessage: DOMString; external name 'statusMessage';
  public
    property statusMessage: DOMString read FstatusMessage;
  end;
  class TJSWebGLContextEventInit = external name 'WebGLContextEventInit' (TJSEventInit)
  public
    statusMessage: DOMString;
  end;
implementation
end;

Regards,
Ryan Joseph

Reply by email

Mattias Gaertner
to Ryan Joseph
Show quoted text 5 lines
> On May 2, 2018, at 2:08 PM, Michael Van Canneyt wrote: > > Yes. the fpmkunit needs to be the latest version, for the AddLibrary call. I will see if I can work around it. So I need to build the entire compiler and I get pas2js in the end? I didn’t realize it was built on the entire FPC compiler but I guess that makes sense.

pas2js can be built with the released fpc 3.0.4 too. The problem is the fpmake files as Michael pointed out. They should be adapted to support fpc 3.0.4.

Show quoted text 9 lines
Just for fun I made a PHP script to parse that .idl file. :) Not sure if it works on other files but it only took a few hours and seems to work ok. Should be easy to hack with. https://github.com/genericptr/pas2js-IDL-parser php pas2js_idl_parser.php /Users/ryanjoseph/Downloads/webgl.idl ======== unit webgl;

What is the difference to the existing webgl.pas?

Mattias

Reply by email

Ryan Joseph
to Mattias Gaertner
On May 2, 2018, at 5:28 PM, Mattias Gaertner wrote: What is the difference to the existing webgl.pas?

It’s missing a couple types and missing comments. :) I can fix that of course and works for other .idl’s also I presume (if you have any other examples send them and I’ll try). The current file is WebGL 1.0 but I noticed there’s a 2.0 file also. Any reason we used 1.0?

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 7 lines
> On May 2, 2018, at 5:28 PM, Mattias Gaertner wrote: > > What is the difference to the existing webgl.pas? It’s missing a couple types and missing comments. :) I can fix that of course and works for other .idl’s also I presume (if you have any other examples send them and I’ll try). The current file is WebGL 1.0 but I noticed there’s a 2.0 file also. Any reason we used 1.0?

Yes: You posted the link to 1.0.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
On May 2, 2018, at 6:20 PM, Michael Van Canneyt wrote: Yes: You posted the link to 1.0.

I think it’s actually an extension to the original so nothing was lost. The original didn’t have vertex array objects so it’s best to have both.

https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl2.idl

That’s what my parser dumps out in current state (some bugs I know). I think TJSWebGL2RenderingContextBase is supposed to be a subclass of the first context base class to make it work.

unit webgl2;
{$mode objfpc}
{$modeswitch externalclass}
interface
uses
  JS, Web;
  type GLint64 = nativeint;
  type GLuint64 = unsigned long long;
  class TJSWebGLQuery = external name 'WebGLQuery' (TJSWebGLObject);
  class TJSWebGLSampler = external name 'WebGLSampler' (TJSWebGLObject);
  class TJSWebGLSync = external name 'WebGLSync' (TJSWebGLObject);
  class TJSWebGLTransformFeedback = external name 'WebGLTransformFeedback' (TJSWebGLObject);
  class TJSWebGLVertexArrayObject = external name 'WebGLVertexArrayObject' (TJSWebGLObject);
  class TJSWebGL2RenderingContextBase = external name 'WebGL2RenderingContextBase' (TJSObject)
  public
    const READ_BUFFER: nativeint;
    const UNPACK_ROW_LENGTH: nativeint;
    const UNPACK_SKIP_ROWS: nativeint;
    const UNPACK_SKIP_PIXELS: nativeint;
    const PACK_ROW_LENGTH: nativeint;
    const PACK_SKIP_ROWS: nativeint;
    const PACK_SKIP_PIXELS: nativeint;
    const COLOR: nativeint;
    const DEPTH: nativeint;
    const STENCIL: nativeint;
    const RED: nativeint;
    const RGB8: nativeint;
    const RGBA8: nativeint;
    const RGB10_A2: nativeint;
    const TEXTURE_BINDING_3D: nativeint;
    const UNPACK_SKIP_IMAGES: nativeint;
    const UNPACK_IMAGE_HEIGHT: nativeint;
    const TEXTURE_3D: nativeint;
    const TEXTURE_WRAP_R: nativeint;
    const MAX_3D_TEXTURE_SIZE: nativeint;
    const UNSIGNED_INT_2_10_10_10_REV: nativeint;
    const MAX_ELEMENTS_VERTICES: nativeint;
    const MAX_ELEMENTS_INDICES: nativeint;
    const TEXTURE_MIN_LOD: nativeint;
    const TEXTURE_MAX_LOD: nativeint;
    const TEXTURE_BASE_LEVEL: nativeint;
    const TEXTURE_MAX_LEVEL: nativeint;
    const MIN: nativeint;
    const MAX: nativeint;
    const DEPTH_COMPONENT24: nativeint;
    const MAX_TEXTURE_LOD_BIAS: nativeint;
    const TEXTURE_COMPARE_MODE: nativeint;
    const TEXTURE_COMPARE_FUNC: nativeint;
    const CURRENT_QUERY: nativeint;
    const QUERY_RESULT: nativeint;
    const QUERY_RESULT_AVAILABLE: nativeint;
    const STREAM_READ: nativeint;
    const STREAM_COPY: nativeint;
    const STATIC_READ: nativeint;
    const STATIC_COPY: nativeint;
    const DYNAMIC_READ: nativeint;
    const DYNAMIC_COPY: nativeint;
    const MAX_DRAW_BUFFERS: nativeint;
    const DRAW_BUFFER0: nativeint;
    const DRAW_BUFFER1: nativeint;
    const DRAW_BUFFER2: nativeint;
    const DRAW_BUFFER3: nativeint;
    const DRAW_BUFFER4: nativeint;
    const DRAW_BUFFER5: nativeint;
    const DRAW_BUFFER6: nativeint;
    const DRAW_BUFFER7: nativeint;
    const DRAW_BUFFER8: nativeint;
    const DRAW_BUFFER9: nativeint;
    const DRAW_BUFFER10: nativeint;
    const DRAW_BUFFER11: nativeint;
    const DRAW_BUFFER12: nativeint;
    const DRAW_BUFFER13: nativeint;
    const DRAW_BUFFER14: nativeint;
    const DRAW_BUFFER15: nativeint;
    const MAX_FRAGMENT_UNIFORM_COMPONENTS: nativeint;
    const MAX_VERTEX_UNIFORM_COMPONENTS: nativeint;
    const SAMPLER_3D: nativeint;
    const SAMPLER_2D_SHADOW: nativeint;
    const FRAGMENT_SHADER_DERIVATIVE_HINT: nativeint;
    const PIXEL_PACK_BUFFER: nativeint;
    const PIXEL_UNPACK_BUFFER: nativeint;
    const PIXEL_PACK_BUFFER_BINDING: nativeint;
    const PIXEL_UNPACK_BUFFER_BINDING: nativeint;
    const FLOAT_MAT2x3: nativeint;
    const FLOAT_MAT2x4: nativeint;
    const FLOAT_MAT3x2: nativeint;
    const FLOAT_MAT3x4: nativeint;
    const FLOAT_MAT4x2: nativeint;
    const FLOAT_MAT4x3: nativeint;
    const SRGB: nativeint;
    const SRGB8: nativeint;
    const SRGB8_ALPHA8: nativeint;
    const COMPARE_REF_TO_TEXTURE: nativeint;
    const RGBA32F: nativeint;
    const RGB32F: nativeint;
    const RGBA16F: nativeint;
    const RGB16F: nativeint;
    const VERTEX_ATTRIB_ARRAY_INTEGER: nativeint;
    const MAX_ARRAY_TEXTURE_LAYERS: nativeint;
    const MIN_PROGRAM_TEXEL_OFFSET: nativeint;
    const MAX_PROGRAM_TEXEL_OFFSET: nativeint;
    const MAX_VARYING_COMPONENTS: nativeint;
    const TEXTURE_2D_ARRAY: nativeint;
    const TEXTURE_BINDING_2D_ARRAY: nativeint;
    const R11F_G11F_B10F: nativeint;
    const UNSIGNED_INT_10F_11F_11F_REV: nativeint;
    const RGB9_E5: nativeint;
    const UNSIGNED_INT_5_9_9_9_REV: nativeint;
    const TRANSFORM_FEEDBACK_BUFFER_MODE: nativeint;
    const MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: nativeint;
    const TRANSFORM_FEEDBACK_VARYINGS: nativeint;
    const TRANSFORM_FEEDBACK_BUFFER_START: nativeint;
    const TRANSFORM_FEEDBACK_BUFFER_SIZE: nativeint;
    const TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: nativeint;
    const RASTERIZER_DISCARD: nativeint;
    const MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: nativeint;
    const MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: nativeint;
    const INTERLEAVED_ATTRIBS: nativeint;
    const SEPARATE_ATTRIBS: nativeint;
    const TRANSFORM_FEEDBACK_BUFFER: nativeint;
    const TRANSFORM_FEEDBACK_BUFFER_BINDING: nativeint;
    const RGBA32UI: nativeint;
    const RGB32UI: nativeint;
    const RGBA16UI: nativeint;
    const RGB16UI: nativeint;
    const RGBA8UI: nativeint;
    const RGB8UI: nativeint;
    const RGBA32I: nativeint;
    const RGB32I: nativeint;
    const RGBA16I: nativeint;
    const RGB16I: nativeint;
    const RGBA8I: nativeint;
    const RGB8I: nativeint;
    const RED_INTEGER: nativeint;
    const RGB_INTEGER: nativeint;
    const RGBA_INTEGER: nativeint;
    const SAMPLER_2D_ARRAY: nativeint;
    const SAMPLER_2D_ARRAY_SHADOW: nativeint;
    const SAMPLER_CUBE_SHADOW: nativeint;
    const UNSIGNED_INT_VEC2: nativeint;
    const UNSIGNED_INT_VEC3: nativeint;
    const UNSIGNED_INT_VEC4: nativeint;
    const INT_SAMPLER_2D: nativeint;
    const INT_SAMPLER_3D: nativeint;
    const INT_SAMPLER_CUBE: nativeint;
    const INT_SAMPLER_2D_ARRAY: nativeint;
    const UNSIGNED_INT_SAMPLER_2D: nativeint;
    const UNSIGNED_INT_SAMPLER_3D: nativeint;
    const UNSIGNED_INT_SAMPLER_CUBE: nativeint;
    const UNSIGNED_INT_SAMPLER_2D_ARRAY: nativeint;
    const DEPTH_COMPONENT32F: nativeint;
    const DEPTH32F_STENCIL8: nativeint;
    const FLOAT_32_UNSIGNED_INT_24_8_REV: nativeint;
    const FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: nativeint;
    const FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_RED_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: nativeint;
    const FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: nativeint;
    const FRAMEBUFFER_DEFAULT: nativeint;
    const DEPTH_STENCIL_ATTACHMENT: nativeint;
    const DEPTH_STENCIL: nativeint;
    const UNSIGNED_INT_24_8: nativeint;
    const DEPTH24_STENCIL8: nativeint;
    const UNSIGNED_NORMALIZED: nativeint;
    const DRAW_FRAMEBUFFER_BINDING: nativeint;
    const READ_FRAMEBUFFER: nativeint;
    const DRAW_FRAMEBUFFER: nativeint;
    const READ_FRAMEBUFFER_BINDING: nativeint;
    const RENDERBUFFER_SAMPLES: nativeint;
    const FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: nativeint;
    const MAX_COLOR_ATTACHMENTS: nativeint;
    const COLOR_ATTACHMENT1: nativeint;
    const COLOR_ATTACHMENT2: nativeint;
    const COLOR_ATTACHMENT3: nativeint;
    const COLOR_ATTACHMENT4: nativeint;
    const COLOR_ATTACHMENT5: nativeint;
    const COLOR_ATTACHMENT6: nativeint;
    const COLOR_ATTACHMENT7: nativeint;
    const COLOR_ATTACHMENT8: nativeint;
    const COLOR_ATTACHMENT9: nativeint;
    const COLOR_ATTACHMENT10: nativeint;
    const COLOR_ATTACHMENT11: nativeint;
    const COLOR_ATTACHMENT12: nativeint;
    const COLOR_ATTACHMENT13: nativeint;
    const COLOR_ATTACHMENT14: nativeint;
    const COLOR_ATTACHMENT15: nativeint;
    const FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: nativeint;
    const MAX_SAMPLES: nativeint;
    const HALF_FLOAT: nativeint;
    const RG: nativeint;
    const RG_INTEGER: nativeint;
    const R8: nativeint;
    const RG8: nativeint;
    const R16F: nativeint;
    const R32F: nativeint;
    const RG16F: nativeint;
    const RG32F: nativeint;
    const R8I: nativeint;
    const R8UI: nativeint;
    const R16I: nativeint;
    const R16UI: nativeint;
    const R32I: nativeint;
    const R32UI: nativeint;
    const RG8I: nativeint;
    const RG8UI: nativeint;
    const RG16I: nativeint;
    const RG16UI: nativeint;
    const RG32I: nativeint;
    const RG32UI: nativeint;
    const VERTEX_ARRAY_BINDING: nativeint;
    const R8_SNORM: nativeint;
    const RG8_SNORM: nativeint;
    const RGB8_SNORM: nativeint;
    const RGBA8_SNORM: nativeint;
    const SIGNED_NORMALIZED: nativeint;
    const COPY_READ_BUFFER: nativeint;
    const COPY_WRITE_BUFFER: nativeint;
    const COPY_READ_BUFFER_BINDING: nativeint;
    const COPY_WRITE_BUFFER_BINDING: nativeint;
    const UNIFORM_BUFFER: nativeint;
    const UNIFORM_BUFFER_BINDING: nativeint;
    const UNIFORM_BUFFER_START: nativeint;
    const UNIFORM_BUFFER_SIZE: nativeint;
    const MAX_VERTEX_UNIFORM_BLOCKS: nativeint;
    const MAX_FRAGMENT_UNIFORM_BLOCKS: nativeint;
    const MAX_COMBINED_UNIFORM_BLOCKS: nativeint;
    const MAX_UNIFORM_BUFFER_BINDINGS: nativeint;
    const MAX_UNIFORM_BLOCK_SIZE: nativeint;
    const MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: nativeint;
    const MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: nativeint;
    const UNIFORM_BUFFER_OFFSET_ALIGNMENT: nativeint;
    const ACTIVE_UNIFORM_BLOCKS: nativeint;
    const UNIFORM_TYPE: nativeint;
    const UNIFORM_SIZE: nativeint;
    const UNIFORM_BLOCK_INDEX: nativeint;
    const UNIFORM_OFFSET: nativeint;
    const UNIFORM_ARRAY_STRIDE: nativeint;
    const UNIFORM_MATRIX_STRIDE: nativeint;
    const UNIFORM_IS_ROW_MAJOR: nativeint;
    const UNIFORM_BLOCK_BINDING: nativeint;
    const UNIFORM_BLOCK_DATA_SIZE: nativeint;
    const UNIFORM_BLOCK_ACTIVE_UNIFORMS: nativeint;
    const UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: nativeint;
    const UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: nativeint;
    const UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: nativeint;
    const INVALID_INDEX: nativeint;
    const MAX_VERTEX_OUTPUT_COMPONENTS: nativeint;
    const MAX_FRAGMENT_INPUT_COMPONENTS: nativeint;
    const MAX_SERVER_WAIT_TIMEOUT: nativeint;
    const OBJECT_TYPE: nativeint;
    const SYNC_CONDITION: nativeint;
    const SYNC_STATUS: nativeint;
    const SYNC_FLAGS: nativeint;
    const SYNC_FENCE: nativeint;
    const SYNC_GPU_COMMANDS_COMPLETE: nativeint;
    const UNSIGNALED: nativeint;
    const SIGNALED: nativeint;
    const ALREADY_SIGNALED: nativeint;
    const TIMEOUT_EXPIRED: nativeint;
    const CONDITION_SATISFIED: nativeint;
    const WAIT_FAILED: nativeint;
    const SYNC_FLUSH_COMMANDS_BIT: nativeint;
    const VERTEX_ATTRIB_ARRAY_DIVISOR: nativeint;
    const ANY_SAMPLES_PASSED: nativeint;
    const ANY_SAMPLES_PASSED_CONSERVATIVE: nativeint;
    const SAMPLER_BINDING: nativeint;
    const RGB10_A2UI: nativeint;
    const INT_2_10_10_10_REV: nativeint;
    const TRANSFORM_FEEDBACK: nativeint;
    const TRANSFORM_FEEDBACK_PAUSED: nativeint;
    const TRANSFORM_FEEDBACK_ACTIVE: nativeint;
    const TRANSFORM_FEEDBACK_BINDING: nativeint;
    const TEXTURE_IMMUTABLE_FORMAT: nativeint;
    const MAX_ELEMENT_INDEX: nativeint;
    const TEXTURE_IMMUTABLE_LEVELS: nativeint;
    const MAX_CLIENT_WAIT_TIMEOUT_WEBGL: nativeint;
    procedure bufferData (target: GLenum; size: GLsizeiptr; usage: GLenum);
    procedure bufferData (target: GLenum; srcData: BufferSource; usage: GLenum);
    procedure bufferSubData (target: GLenum; dstByteOffset: GLintptr; srcData: BufferSource);
    procedure bufferData (target: GLenum; srcData: ArrayBufferView; usage: GLenum; srcOffset: GLuint; length: GLuint);
    procedure bufferSubData (target: GLenum; dstByteOffset: GLintptr; srcData: ArrayBufferView; length: GLuint);
    procedure copyBufferSubData (readTarget: GLenum; writeTarget: GLenum; readOffset: GLintptr; size: GLsizeiptr);
    procedure getBufferSubData (target: GLenum; srcByteOffset: GLintptr; dstBuffer: ArrayBufferView; dstOffset: GLuint; length: GLuint);
    procedure blitFramebuffer (srcX0: GLint; srcY0: GLint; srcX1: GLint; srcY1: GLint; dstX0: GLint; dstY0: GLint; dstY1: GLint; mask: GLbitfield; filter: GLenum);
    procedure framebufferTextureLayer (target: GLenum; attachment: GLenum; texture: TJSWebGLTexture; level: GLint);
    procedure invalidateFramebuffer (target: GLenum; attachments: GLenumDynArray);
    procedure invalidateSubFramebuffer (target: GLenum; attachments: GLenumDynArray; y: GLint; width: GLsizei; height: GLsizei);
    procedure readBuffer (src: GLenum);
    function getInternalformatParameter (target: GLenum; internalformat: GLenum; pname: GLenum): JSValue;
    procedure renderbufferStorageMultisample (target: GLenum; samples: GLsizei; internalformat: GLenum; height: GLsizei);
    procedure texStorage2D (target: GLenum; levels: GLsizei; internalformat: GLenum; width: GLsizei);
    procedure texStorage3D (target: GLenum; levels: GLsizei; internalformat: GLenum; width: GLsizei; depth: GLsizei);
    procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; height: GLsizei; border: GLint; format: GLenum; pixels: ArrayBufferView);
    procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; type: GLenum; source: TexImageSource);
    procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; type: GLenum; pixels: ArrayBufferView);
    procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; type: GLenum; source: TexImageSource);
    procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; pboOffset: GLintptr);
    procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
    procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; srcData: ArrayBufferView);
    procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; pboOffset: GLintptr);
    procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum);
    procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; srcData: ArrayBufferView);
    procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; srcData: ArrayBufferView);
    procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum; pboOffset: GLintptr);
    procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum);
    procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum; srcData: ArrayBufferView);
    procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum);
    procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum);
    procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum; srcOffset: GLuint);
    procedure copyTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; y: GLint; width: GLsizei; height: GLsizei);
    procedure compressedTexImage2D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; offset: GLintptr);
    procedure compressedTexImage2D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
    procedure compressedTexImage3D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; offset: GLintptr);
    procedure compressedTexImage3D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; depth: GLsizei; border: GLint; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
    procedure compressedTexSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; format: GLenum; imageSize: GLsizei; offset: GLintptr);
    procedure compressedTexSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; format: GLenum; srcOffset: GLuint; srcLengthOverride: GLuint);
    procedure compressedTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; imageSize: GLsizei; offset: GLintptr);
    procedure compressedTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
    function getFragDataLocation (program: WebGLProgram; name: DOMString): GLint;
    procedure uniform1ui (location: TJSWebGLUniformLocation; v0: GLuint);
    procedure uniform2ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint);
    procedure uniform3ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint; v2: GLuint);
    procedure uniform4ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint; v2: GLuint; v3: GLuint);
    procedure uniform1fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform2fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform3fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform4fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform1iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform2iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform3iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform4iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform1uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform2uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform3uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniform4uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix3x2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix4x2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix2x3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix4x3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix2x4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix3x4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure uniformMatrix4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
    procedure vertexAttribI4i (index: GLuint; x: GLint; y: GLint; z: GLint; w: GLint);
    procedure vertexAttribI4iv (index: GLuint; values: Int32List);
    procedure vertexAttribI4ui (index: GLuint; x: GLuint; y: GLuint; z: GLuint; w: GLuint);
    procedure vertexAttribI4uiv (index: GLuint; values: Uint32List);
    procedure vertexAttribIPointer (index: GLuint; size: GLint; type: GLenum; stride: GLsizei; offset: GLintptr);
    procedure vertexAttribDivisor (index: GLuint; divisor: GLuint);
    procedure drawArraysInstanced (mode: GLenum; first: GLint; count: GLsizei; instanceCount: GLsizei);
    procedure drawElementsInstanced (mode: GLenum; count: GLsizei; type: GLenum; offset: GLintptr; instanceCount: GLsizei);
    procedure drawRangeElements (mode: GLenum; start: GLuint; end: GLuint; count: GLsizei; type: GLenum; offset: GLintptr);
    procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
    procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
    procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; dstOffset: GLuint);
    procedure drawBuffers (buffers: GLenumDynArray);
    procedure clearBufferfv (buffer: GLenum; drawbuffer: GLint; values: Float32List; srcOffset: GLuint);
    procedure clearBufferiv (buffer: GLenum; drawbuffer: GLint; values: Int32List; srcOffset: GLuint);
    procedure clearBufferuiv (buffer: GLenum; drawbuffer: GLint; values: Uint32List; srcOffset: GLuint);
    procedure clearBufferfi (buffer: GLenum; drawbuffer: GLint; depth: GLfloat; stencil: GLint);
    function createQuery: TJSWebGLQuery;
    procedure deleteQuery (query: TJSWebGLQuery);
    function isQuery (query: TJSWebGLQuery): GLboolean;
    procedure beginQuery (target: GLenum; query: WebGLQuery);
    procedure endQuery (target: GLenum);
    function getQuery (target: GLenum; pname: GLenum): TJSWebGLQuery;
    function getQueryParameter (query: WebGLQuery; pname: GLenum): JSValue;
    function createSampler: TJSWebGLSampler;
    procedure deleteSampler (sampler: TJSWebGLSampler);
    function isSampler (sampler: TJSWebGLSampler): GLboolean;
    procedure bindSampler (unit: GLuint; sampler: TJSWebGLSampler);
    procedure samplerParameteri (sampler: WebGLSampler; pname: GLenum; param: GLint);
    procedure samplerParameterf (sampler: WebGLSampler; pname: GLenum; param: GLfloat);
    function getSamplerParameter (sampler: WebGLSampler; pname: GLenum): JSValue;
    function fenceSync (condition: GLenum; flags: GLbitfield): TJSWebGLSync;
    function isSync (sync: TJSWebGLSync): GLboolean;
    procedure deleteSync (sync: TJSWebGLSync);
    function clientWaitSync (sync: WebGLSync; flags: GLbitfield; timeout: GLuint64): GLenum;
    procedure waitSync (sync: WebGLSync; flags: GLbitfield; timeout: GLint64);
    function getSyncParameter (sync: WebGLSync; pname: GLenum): JSValue;
    function createTransformFeedback: TJSWebGLTransformFeedback;
    procedure deleteTransformFeedback (tf: TJSWebGLTransformFeedback);
    function isTransformFeedback (tf: TJSWebGLTransformFeedback): GLboolean;
    procedure bindTransformFeedback (target: GLenum; tf: TJSWebGLTransformFeedback);
    procedure beginTransformFeedback (primitiveMode: GLenum);
    procedure endTransformFeedback;
    procedure transformFeedbackVaryings (program: WebGLProgram; varyings: DOMStringDynArray; bufferMode: GLenum);
    function getTransformFeedbackVarying (program: WebGLProgram; index: GLuint): TJSWebGLActiveInfo;
    procedure pauseTransformFeedback;
    procedure resumeTransformFeedback;
    procedure bindBufferBase (target: GLenum; index: GLuint; buffer: TJSWebGLBuffer);
    procedure bindBufferRange (target: GLenum; index: GLuint; buffer: TJSWebGLBuffer; offset: GLintptr; size: GLsizeiptr);
    function getIndexedParameter (target: GLenum; index: GLuint): JSValue;
    function getUniformIndices (program: WebGLProgram; uniformNames: DOMStringDynArray): GLuintDynArray;
    function getActiveUniforms (program: WebGLProgram; uniformIndices: GLuintDynArray; pname: GLenum): JSValue;
    function getUniformBlockIndex (program: WebGLProgram; uniformBlockName: DOMString): GLuint;
    function getActiveUniformBlockParameter (program: WebGLProgram; uniformBlockIndex: GLuint; pname: GLenum): JSValue;
    function getActiveUniformBlockName (program: WebGLProgram; uniformBlockIndex: GLuint): TJSDOMString;
    procedure uniformBlockBinding (program: WebGLProgram; uniformBlockIndex: GLuint; uniformBlockBinding: GLuint);
    function createVertexArray: TJSWebGLVertexArrayObject;
    procedure deleteVertexArray (vertexArray: TJSWebGLVertexArrayObject);
    function isVertexArray (vertexArray: TJSWebGLVertexArrayObject): GLboolean;
    procedure bindVertexArray (array: TJSWebGLVertexArrayObject);
  end;
  class TJSWebGL2RenderingContext = external name 'WebGL2RenderingContext' (TJSWebGL2RenderingContextBase);
implementation
end;

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph schrieb am Mi., 2. Mai 2018, 15:57:

class TJSWebGL2RenderingContextBase = external name 'WebGL2RenderingContextBase' (TJSObject)

It's "Typename = class external name 'foobar' (Basetype)", not "class Typename = external name 'foobar' (Basetype)". We're not in C++ after all :P

  public
const READ_BUFFER: nativeint; const UNPACK_ROW_LENGTH: nativeint;

Just in case you aren't aware of it: "const", "type" and "var" start sections, even inside classes/records, so you don't need to repeat the "const". Instead it is common to write "public const" and then write all constant members.

Regards,
Sven

Reply by email

Ryan Joseph
to Sven Barth
Show quoted text 10 lines
On May 2, 2018, at 11:36 PM, Sven Barth via fpc-pascal wrote: It's "Typename = class external name 'foobar' (Basetype)", not "class Typename = external name 'foobar' (Basetype)". We're not in C++ after all :P public const READ_BUFFER: nativeint; const UNPACK_ROW_LENGTH: nativeint; Just in case you aren't aware of it: "const", "type" and "var" start sections, even inside classes/records, so you don't need to repeat the "const". Instead it is common to write "public const" and then write all constant members.

Not paying attention at all yesterday going from PHP to Pascal. It’s fixed now and looks better but the formatting is not standard perhaps.

The .idls still had those lines I wasn’t sure what to do with so I ignored them. I think enums should be string types followed by constants (if that’s allowed by the parser).

enum WebGLPowerPreference should probably be:

type
  TWebGLPowerPreference = string;
const
  TWebGLPowerPreferenceDefault = ‘default’;
  etc…

Who knows about or’d typedefs though. better to do those by hand or dump them as comments.

enum WebGLPowerPreference { "default", "low-power", "high-performance" };

typedef (ImageBitmap or
ImageData or
HTMLImageElement or
HTMLCanvasElement or

         HTMLVideoElement) TexImageSource;
typedef ([AllowShared] Float32Array or sequence<GLfloat>) Float32List;
typedef ([AllowShared] Int32Array or sequence<GLint>) Int32List;

==========

unit webgl2;
{$mode objfpc}
{$modeswitch externalclass}
interface
uses
  JS, Web;
  type
    GLint64 = nativeint;
    GLuint64 = longword;
  type
    TJSWebGLQuery = class external name 'WebGLQuery' (TJSWebGLObject);
    TJSWebGLSampler = class external name 'WebGLSampler' (TJSWebGLObject);
    TJSWebGLSync = class external name 'WebGLSync' (TJSWebGLObject);
    TJSWebGLTransformFeedback = class external name 'WebGLTransformFeedback' (TJSWebGLObject);
    TJSWebGLVertexArrayObject = class external name 'WebGLVertexArrayObject' (TJSWebGLObject);
  type
    TJSWebGL2RenderingContextBase = class external name 'WebGL2RenderingContextBase' (TJSObject)
    public
    const
      READ_BUFFER: nativeint;
      UNPACK_ROW_LENGTH: nativeint;
      UNPACK_SKIP_ROWS: nativeint;
      UNPACK_SKIP_PIXELS: nativeint;
      PACK_ROW_LENGTH: nativeint;
      PACK_SKIP_ROWS: nativeint;
      PACK_SKIP_PIXELS: nativeint;
      COLOR: nativeint;
      DEPTH: nativeint;
      STENCIL: nativeint;
      RED: nativeint;
      RGB8: nativeint;
      RGBA8: nativeint;
      RGB10_A2: nativeint;
      TEXTURE_BINDING_3D: nativeint;
      UNPACK_SKIP_IMAGES: nativeint;
      UNPACK_IMAGE_HEIGHT: nativeint;
      TEXTURE_3D: nativeint;
      TEXTURE_WRAP_R: nativeint;
      MAX_3D_TEXTURE_SIZE: nativeint;
      UNSIGNED_INT_2_10_10_10_REV: nativeint;
      MAX_ELEMENTS_VERTICES: nativeint;
      MAX_ELEMENTS_INDICES: nativeint;
      TEXTURE_MIN_LOD: nativeint;
      TEXTURE_MAX_LOD: nativeint;
      TEXTURE_BASE_LEVEL: nativeint;
      TEXTURE_MAX_LEVEL: nativeint;
      MIN: nativeint;
      MAX: nativeint;
      DEPTH_COMPONENT24: nativeint;
      MAX_TEXTURE_LOD_BIAS: nativeint;
      TEXTURE_COMPARE_MODE: nativeint;
      TEXTURE_COMPARE_FUNC: nativeint;
      CURRENT_QUERY: nativeint;
      QUERY_RESULT: nativeint;
      QUERY_RESULT_AVAILABLE: nativeint;
      STREAM_READ: nativeint;
      STREAM_COPY: nativeint;
      STATIC_READ: nativeint;
      STATIC_COPY: nativeint;
      DYNAMIC_READ: nativeint;
      DYNAMIC_COPY: nativeint;
      MAX_DRAW_BUFFERS: nativeint;
      DRAW_BUFFER0: nativeint;
      DRAW_BUFFER1: nativeint;
      DRAW_BUFFER2: nativeint;
      DRAW_BUFFER3: nativeint;
      DRAW_BUFFER4: nativeint;
      DRAW_BUFFER5: nativeint;
      DRAW_BUFFER6: nativeint;
      DRAW_BUFFER7: nativeint;
      DRAW_BUFFER8: nativeint;
      DRAW_BUFFER9: nativeint;
      DRAW_BUFFER10: nativeint;
      DRAW_BUFFER11: nativeint;
      DRAW_BUFFER12: nativeint;
      DRAW_BUFFER13: nativeint;
      DRAW_BUFFER14: nativeint;
      DRAW_BUFFER15: nativeint;
      MAX_FRAGMENT_UNIFORM_COMPONENTS: nativeint;
      MAX_VERTEX_UNIFORM_COMPONENTS: nativeint;
      SAMPLER_3D: nativeint;
      SAMPLER_2D_SHADOW: nativeint;
      FRAGMENT_SHADER_DERIVATIVE_HINT: nativeint;
      PIXEL_PACK_BUFFER: nativeint;
      PIXEL_UNPACK_BUFFER: nativeint;
      PIXEL_PACK_BUFFER_BINDING: nativeint;
      PIXEL_UNPACK_BUFFER_BINDING: nativeint;
      FLOAT_MAT2x3: nativeint;
      FLOAT_MAT2x4: nativeint;
      FLOAT_MAT3x2: nativeint;
      FLOAT_MAT3x4: nativeint;
      FLOAT_MAT4x2: nativeint;
      FLOAT_MAT4x3: nativeint;
      SRGB: nativeint;
      SRGB8: nativeint;
      SRGB8_ALPHA8: nativeint;
      COMPARE_REF_TO_TEXTURE: nativeint;
      RGBA32F: nativeint;
      RGB32F: nativeint;
      RGBA16F: nativeint;
      RGB16F: nativeint;
      VERTEX_ATTRIB_ARRAY_INTEGER: nativeint;
      MAX_ARRAY_TEXTURE_LAYERS: nativeint;
      MIN_PROGRAM_TEXEL_OFFSET: nativeint;
      MAX_PROGRAM_TEXEL_OFFSET: nativeint;
      MAX_VARYING_COMPONENTS: nativeint;
      TEXTURE_2D_ARRAY: nativeint;
      TEXTURE_BINDING_2D_ARRAY: nativeint;
      R11F_G11F_B10F: nativeint;
      UNSIGNED_INT_10F_11F_11F_REV: nativeint;
      RGB9_E5: nativeint;
      UNSIGNED_INT_5_9_9_9_REV: nativeint;
      TRANSFORM_FEEDBACK_BUFFER_MODE: nativeint;
      MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: nativeint;
      TRANSFORM_FEEDBACK_VARYINGS: nativeint;
      TRANSFORM_FEEDBACK_BUFFER_START: nativeint;
      TRANSFORM_FEEDBACK_BUFFER_SIZE: nativeint;
      TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: nativeint;
      RASTERIZER_DISCARD: nativeint;
      MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: nativeint;
      MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: nativeint;
      INTERLEAVED_ATTRIBS: nativeint;
      SEPARATE_ATTRIBS: nativeint;
      TRANSFORM_FEEDBACK_BUFFER: nativeint;
      TRANSFORM_FEEDBACK_BUFFER_BINDING: nativeint;
      RGBA32UI: nativeint;
      RGB32UI: nativeint;
      RGBA16UI: nativeint;
      RGB16UI: nativeint;
      RGBA8UI: nativeint;
      RGB8UI: nativeint;
      RGBA32I: nativeint;
      RGB32I: nativeint;
      RGBA16I: nativeint;
      RGB16I: nativeint;
      RGBA8I: nativeint;
      RGB8I: nativeint;
      RED_INTEGER: nativeint;
      RGB_INTEGER: nativeint;
      RGBA_INTEGER: nativeint;
      SAMPLER_2D_ARRAY: nativeint;
      SAMPLER_2D_ARRAY_SHADOW: nativeint;
      SAMPLER_CUBE_SHADOW: nativeint;
      UNSIGNED_INT_VEC2: nativeint;
      UNSIGNED_INT_VEC3: nativeint;
      UNSIGNED_INT_VEC4: nativeint;
      INT_SAMPLER_2D: nativeint;
      INT_SAMPLER_3D: nativeint;
      INT_SAMPLER_CUBE: nativeint;
      INT_SAMPLER_2D_ARRAY: nativeint;
      UNSIGNED_INT_SAMPLER_2D: nativeint;
      UNSIGNED_INT_SAMPLER_3D: nativeint;
      UNSIGNED_INT_SAMPLER_CUBE: nativeint;
      UNSIGNED_INT_SAMPLER_2D_ARRAY: nativeint;
      DEPTH_COMPONENT32F: nativeint;
      DEPTH32F_STENCIL8: nativeint;
      FLOAT_32_UNSIGNED_INT_24_8_REV: nativeint;
      FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: nativeint;
      FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: nativeint;
      FRAMEBUFFER_ATTACHMENT_RED_SIZE: nativeint;
      FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: nativeint;
      FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: nativeint;
      FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: nativeint;
      FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: nativeint;
      FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: nativeint;
      FRAMEBUFFER_DEFAULT: nativeint;
      DEPTH_STENCIL_ATTACHMENT: nativeint;
      DEPTH_STENCIL: nativeint;
      UNSIGNED_INT_24_8: nativeint;
      DEPTH24_STENCIL8: nativeint;
      UNSIGNED_NORMALIZED: nativeint;
      DRAW_FRAMEBUFFER_BINDING: nativeint;
      READ_FRAMEBUFFER: nativeint;
      DRAW_FRAMEBUFFER: nativeint;
      READ_FRAMEBUFFER_BINDING: nativeint;
      RENDERBUFFER_SAMPLES: nativeint;
      FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: nativeint;
      MAX_COLOR_ATTACHMENTS: nativeint;
      COLOR_ATTACHMENT1: nativeint;
      COLOR_ATTACHMENT2: nativeint;
      COLOR_ATTACHMENT3: nativeint;
      COLOR_ATTACHMENT4: nativeint;
      COLOR_ATTACHMENT5: nativeint;
      COLOR_ATTACHMENT6: nativeint;
      COLOR_ATTACHMENT7: nativeint;
      COLOR_ATTACHMENT8: nativeint;
      COLOR_ATTACHMENT9: nativeint;
      COLOR_ATTACHMENT10: nativeint;
      COLOR_ATTACHMENT11: nativeint;
      COLOR_ATTACHMENT12: nativeint;
      COLOR_ATTACHMENT13: nativeint;
      COLOR_ATTACHMENT14: nativeint;
      COLOR_ATTACHMENT15: nativeint;
      FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: nativeint;
      MAX_SAMPLES: nativeint;
      HALF_FLOAT: nativeint;
      RG: nativeint;
      RG_INTEGER: nativeint;
      R8: nativeint;
      RG8: nativeint;
      R16F: nativeint;
      R32F: nativeint;
      RG16F: nativeint;
      RG32F: nativeint;
      R8I: nativeint;
      R8UI: nativeint;
      R16I: nativeint;
      R16UI: nativeint;
      R32I: nativeint;
      R32UI: nativeint;
      RG8I: nativeint;
      RG8UI: nativeint;
      RG16I: nativeint;
      RG16UI: nativeint;
      RG32I: nativeint;
      RG32UI: nativeint;
      VERTEX_ARRAY_BINDING: nativeint;
      R8_SNORM: nativeint;
      RG8_SNORM: nativeint;
      RGB8_SNORM: nativeint;
      RGBA8_SNORM: nativeint;
      SIGNED_NORMALIZED: nativeint;
      COPY_READ_BUFFER: nativeint;
      COPY_WRITE_BUFFER: nativeint;
      COPY_READ_BUFFER_BINDING: nativeint;
      COPY_WRITE_BUFFER_BINDING: nativeint;
      UNIFORM_BUFFER: nativeint;
      UNIFORM_BUFFER_BINDING: nativeint;
      UNIFORM_BUFFER_START: nativeint;
      UNIFORM_BUFFER_SIZE: nativeint;
      MAX_VERTEX_UNIFORM_BLOCKS: nativeint;
      MAX_FRAGMENT_UNIFORM_BLOCKS: nativeint;
      MAX_COMBINED_UNIFORM_BLOCKS: nativeint;
      MAX_UNIFORM_BUFFER_BINDINGS: nativeint;
      MAX_UNIFORM_BLOCK_SIZE: nativeint;
      MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: nativeint;
      MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: nativeint;
      UNIFORM_BUFFER_OFFSET_ALIGNMENT: nativeint;
      ACTIVE_UNIFORM_BLOCKS: nativeint;
      UNIFORM_TYPE: nativeint;
      UNIFORM_SIZE: nativeint;
      UNIFORM_BLOCK_INDEX: nativeint;
      UNIFORM_OFFSET: nativeint;
      UNIFORM_ARRAY_STRIDE: nativeint;
      UNIFORM_MATRIX_STRIDE: nativeint;
      UNIFORM_IS_ROW_MAJOR: nativeint;
      UNIFORM_BLOCK_BINDING: nativeint;
      UNIFORM_BLOCK_DATA_SIZE: nativeint;
      UNIFORM_BLOCK_ACTIVE_UNIFORMS: nativeint;
      UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: nativeint;
      UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: nativeint;
      UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: nativeint;
      INVALID_INDEX: nativeint;
      MAX_VERTEX_OUTPUT_COMPONENTS: nativeint;
      MAX_FRAGMENT_INPUT_COMPONENTS: nativeint;
      MAX_SERVER_WAIT_TIMEOUT: nativeint;
      OBJECT_TYPE: nativeint;
      SYNC_CONDITION: nativeint;
      SYNC_STATUS: nativeint;
      SYNC_FLAGS: nativeint;
      SYNC_FENCE: nativeint;
      SYNC_GPU_COMMANDS_COMPLETE: nativeint;
      UNSIGNALED: nativeint;
      SIGNALED: nativeint;
      ALREADY_SIGNALED: nativeint;
      TIMEOUT_EXPIRED: nativeint;
      CONDITION_SATISFIED: nativeint;
      WAIT_FAILED: nativeint;
      SYNC_FLUSH_COMMANDS_BIT: nativeint;
      VERTEX_ATTRIB_ARRAY_DIVISOR: nativeint;
      ANY_SAMPLES_PASSED: nativeint;
      ANY_SAMPLES_PASSED_CONSERVATIVE: nativeint;
      SAMPLER_BINDING: nativeint;
      RGB10_A2UI: nativeint;
      INT_2_10_10_10_REV: nativeint;
      TRANSFORM_FEEDBACK: nativeint;
      TRANSFORM_FEEDBACK_PAUSED: nativeint;
      TRANSFORM_FEEDBACK_ACTIVE: nativeint;
      TRANSFORM_FEEDBACK_BINDING: nativeint;
      TEXTURE_IMMUTABLE_FORMAT: nativeint;
      MAX_ELEMENT_INDEX: nativeint;
      TEXTURE_IMMUTABLE_LEVELS: nativeint;
      MAX_CLIENT_WAIT_TIMEOUT_WEBGL: nativeint;
    public
      procedure bufferData (target: GLenum; size: GLsizeiptr; usage: GLenum);
      procedure bufferData (target: GLenum; srcData: BufferSource; usage: GLenum);
      procedure bufferSubData (target: GLenum; dstByteOffset: GLintptr; srcData: BufferSource);
      procedure bufferData (target: GLenum; srcData: ArrayBufferView; usage: GLenum; srcOffset: GLuint; length: GLuint);
      procedure bufferSubData (target: GLenum; dstByteOffset: GLintptr; srcData: ArrayBufferView; length: GLuint);
      procedure copyBufferSubData (readTarget: GLenum; writeTarget: GLenum; readOffset: GLintptr; size: GLsizeiptr);
      procedure getBufferSubData (target: GLenum; srcByteOffset: GLintptr; dstBuffer: ArrayBufferView; dstOffset: GLuint; length: GLuint);
      procedure blitFramebuffer (srcX0: GLint; srcY0: GLint; srcX1: GLint; srcY1: GLint; dstX0: GLint; dstY0: GLint; dstY1: GLint; mask: GLbitfield; filter: GLenum);
      procedure framebufferTextureLayer (target: GLenum; attachment: GLenum; texture: TJSWebGLTexture; level: GLint);
      procedure invalidateFramebuffer (target: GLenum; attachments: GLenumDynArray);
      procedure invalidateSubFramebuffer (target: GLenum; attachments: GLenumDynArray; y: GLint; width: GLsizei; height: GLsizei);
      procedure readBuffer (src: GLenum);
      function getInternalformatParameter (target: GLenum; internalformat: GLenum; pname: GLenum): JSValue;
      procedure renderbufferStorageMultisample (target: GLenum; samples: GLsizei; internalformat: GLenum; height: GLsizei);
      procedure texStorage2D (target: GLenum; levels: GLsizei; internalformat: GLenum; width: GLsizei);
      procedure texStorage3D (target: GLenum; levels: GLsizei; internalformat: GLenum; width: GLsizei; depth: GLsizei);
      procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; height: GLsizei; border: GLint; format: GLenum; pixels: ArrayBufferView);
      procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; type: GLenum; source: TexImageSource);
      procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; type: GLenum; pixels: ArrayBufferView);
      procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; type: GLenum; source: TexImageSource);
      procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; pboOffset: GLintptr);
      procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
      procedure texImage2D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; srcData: ArrayBufferView);
      procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; pboOffset: GLintptr);
      procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum);
      procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; srcData: ArrayBufferView);
      procedure texImage3D (target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; srcData: ArrayBufferView);
      procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum; pboOffset: GLintptr);
      procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum);
      procedure texSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; format: GLenum; type: GLenum; srcData: ArrayBufferView);
      procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum);
      procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum);
      procedure texSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; height: GLsizei; depth: GLsizei; format: GLenum; type: GLenum; srcOffset: GLuint);
      procedure copyTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; y: GLint; width: GLsizei; height: GLsizei);
      procedure compressedTexImage2D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; offset: GLintptr);
      procedure compressedTexImage2D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
      procedure compressedTexImage3D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; offset: GLintptr);
      procedure compressedTexImage3D (target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; depth: GLsizei; border: GLint; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
      procedure compressedTexSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; format: GLenum; imageSize: GLsizei; offset: GLintptr);
      procedure compressedTexSubImage2D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; height: GLsizei; format: GLenum; srcOffset: GLuint; srcLengthOverride: GLuint);
      procedure compressedTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; imageSize: GLsizei; offset: GLintptr);
      procedure compressedTexSubImage3D (target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; srcData: ArrayBufferView; srcOffset: GLuint; srcLengthOverride: GLuint);
      function getFragDataLocation (program: WebGLProgram; name: DOMString): GLint;
      procedure uniform1ui (location: TJSWebGLUniformLocation; v0: GLuint);
      procedure uniform2ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint);
      procedure uniform3ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint; v2: GLuint);
      procedure uniform4ui (location: TJSWebGLUniformLocation; v0: GLuint; v1: GLuint; v2: GLuint; v3: GLuint);
      procedure uniform1fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform2fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform3fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform4fv (location: TJSWebGLUniformLocation; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform1iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform2iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform3iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform4iv (location: TJSWebGLUniformLocation; data: Int32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform1uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform2uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform3uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniform4uiv (location: TJSWebGLUniformLocation; data: Uint32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix3x2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix4x2fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix2x3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix4x3fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix2x4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix3x4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure uniformMatrix4fv (location: TJSWebGLUniformLocation; transpose: GLboolean; data: Float32List; srcOffset: GLuint; srcLength: GLuint);
      procedure vertexAttribI4i (index: GLuint; x: GLint; y: GLint; z: GLint; w: GLint);
      procedure vertexAttribI4iv (index: GLuint; values: Int32List);
      procedure vertexAttribI4ui (index: GLuint; x: GLuint; y: GLuint; z: GLuint; w: GLuint);
      procedure vertexAttribI4uiv (index: GLuint; values: Uint32List);
      procedure vertexAttribIPointer (index: GLuint; size: GLint; type: GLenum; stride: GLsizei; offset: GLintptr);
      procedure vertexAttribDivisor (index: GLuint; divisor: GLuint);
      procedure drawArraysInstanced (mode: GLenum; first: GLint; count: GLsizei; instanceCount: GLsizei);
      procedure drawElementsInstanced (mode: GLenum; count: GLsizei; type: GLenum; offset: GLintptr; instanceCount: GLsizei);
      procedure drawRangeElements (mode: GLenum; start: GLuint; end: GLuint; count: GLsizei; type: GLenum; offset: GLintptr);
      procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
      procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum);
      procedure readPixels (x: GLint; y: GLint; width: GLsizei; height: GLsizei; format: GLenum; type: GLenum; dstOffset: GLuint);
      procedure drawBuffers (buffers: GLenumDynArray);
      procedure clearBufferfv (buffer: GLenum; drawbuffer: GLint; values: Float32List; srcOffset: GLuint);
      procedure clearBufferiv (buffer: GLenum; drawbuffer: GLint; values: Int32List; srcOffset: GLuint);
      procedure clearBufferuiv (buffer: GLenum; drawbuffer: GLint; values: Uint32List; srcOffset: GLuint);
      procedure clearBufferfi (buffer: GLenum; drawbuffer: GLint; depth: GLfloat; stencil: GLint);
      function createQuery: TJSWebGLQuery;
      procedure deleteQuery (query: TJSWebGLQuery);
      function isQuery (query: TJSWebGLQuery): GLboolean;
      procedure beginQuery (target: GLenum; query: WebGLQuery);
      procedure endQuery (target: GLenum);
      function getQuery (target: GLenum; pname: GLenum): TJSWebGLQuery;
      function getQueryParameter (query: WebGLQuery; pname: GLenum): JSValue;
      function createSampler: TJSWebGLSampler;
      procedure deleteSampler (sampler: TJSWebGLSampler);
      function isSampler (sampler: TJSWebGLSampler): GLboolean;
      procedure bindSampler (unit: GLuint; sampler: TJSWebGLSampler);
      procedure samplerParameteri (sampler: WebGLSampler; pname: GLenum; param: GLint);
      procedure samplerParameterf (sampler: WebGLSampler; pname: GLenum; param: GLfloat);
      function getSamplerParameter (sampler: WebGLSampler; pname: GLenum): JSValue;
      function fenceSync (condition: GLenum; flags: GLbitfield): TJSWebGLSync;
      function isSync (sync: TJSWebGLSync): GLboolean;
      procedure deleteSync (sync: TJSWebGLSync);
      function clientWaitSync (sync: WebGLSync; flags: GLbitfield; timeout: GLuint64): GLenum;
      procedure waitSync (sync: WebGLSync; flags: GLbitfield; timeout: GLint64);
      function getSyncParameter (sync: WebGLSync; pname: GLenum): JSValue;
      function createTransformFeedback: TJSWebGLTransformFeedback;
      procedure deleteTransformFeedback (tf: TJSWebGLTransformFeedback);
      function isTransformFeedback (tf: TJSWebGLTransformFeedback): GLboolean;
      procedure bindTransformFeedback (target: GLenum; tf: TJSWebGLTransformFeedback);
      procedure beginTransformFeedback (primitiveMode: GLenum);
      procedure endTransformFeedback;
      procedure transformFeedbackVaryings (program: WebGLProgram; varyings: DOMStringDynArray; bufferMode: GLenum);
      function getTransformFeedbackVarying (program: WebGLProgram; index: GLuint): TJSWebGLActiveInfo;
      procedure pauseTransformFeedback;
      procedure resumeTransformFeedback;
      procedure bindBufferBase (target: GLenum; index: GLuint; buffer: TJSWebGLBuffer);
      procedure bindBufferRange (target: GLenum; index: GLuint; buffer: TJSWebGLBuffer; offset: GLintptr; size: GLsizeiptr);
      function getIndexedParameter (target: GLenum; index: GLuint): JSValue;
      function getUniformIndices (program: WebGLProgram; uniformNames: DOMStringDynArray): GLuintDynArray;
      function getActiveUniforms (program: WebGLProgram; uniformIndices: GLuintDynArray; pname: GLenum): JSValue;
      function getUniformBlockIndex (program: WebGLProgram; uniformBlockName: DOMString): GLuint;
      function getActiveUniformBlockParameter (program: WebGLProgram; uniformBlockIndex: GLuint; pname: GLenum): JSValue;
      function getActiveUniformBlockName (program: WebGLProgram; uniformBlockIndex: GLuint): TJSDOMString;
      procedure uniformBlockBinding (program: WebGLProgram; uniformBlockIndex: GLuint; uniformBlockBinding: GLuint);
      function createVertexArray: TJSWebGLVertexArrayObject;
      procedure deleteVertexArray (vertexArray: TJSWebGLVertexArrayObject);
      function isVertexArray (vertexArray: TJSWebGLVertexArrayObject): GLboolean;
      procedure bindVertexArray (array: TJSWebGLVertexArrayObject);
  end;
  TJSWebGL2RenderingContext = class external name 'WebGL2RenderingContext' (TJSWebGL2RenderingContextBase);
implementation
end;

Regards,
Ryan Joseph

Reply by email

Ryan Joseph
to Ryan Joseph

Can someone put a simple guide to building on the wiki? I tried to build from my existing FPC sources and got this error. I never got UNIX down well so I don’t know what else I’m supposed to do besides cd to the directory and use the “make” command. Uploading a stable binary would be nice also but I’m on Mac so maybe only Ingemar has built this before.

Ryans-MacBook-Pro:pas2js ryanjoseph$ make
/usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar -Fu../../packages/fpmkunit/units_bs/i386-darwin PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu PPU Invalid Version 196
Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted
make: *** [fpmake] Error 1

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph schrieb am Do., 3. Mai 2018, 04:54:

Show quoted text 17 lines
Can someone put a simple guide to building on the wiki? I tried to build from my existing FPC sources and got this error. I never got UNIX down well so I don’t know what else I’m supposed to do besides cd to the directory and use the “make” command. Uploading a stable binary would be nice also but I’m on Mac so maybe only Ingemar has built this before. Ryans-MacBook-Pro:pas2js ryanjoseph$ make /usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar -Fu../../packages/fpmkunit/units_bs/i386-darwin PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu PPU Invalid Version 196 Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [fpmake] Error 1

A "make all" in the top level directory should suffice (yes, that will build all of FPC, but that is at least more or less guaranteed to work). You can then pick the pas2js binary from the utils/pas2js/bin directory.

Regards,
Sven

Reply by email

Ryan Joseph
to Sven Barth
On May 3, 2018, at 12:53 PM, Sven Barth via fpc-pascal wrote: A "make all" in the top level directory should suffice (yes, that will build all of FPC, but that is at least more or less guaranteed to work). You can then pick the pas2js binary from the utils/pas2js/bin directory.

where will that output the actual compiler to since I’m building everything now? I’d like to not override any existing installations if possible.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 8 lines
> On May 3, 2018, at 12:53 PM, Sven Barth via fpc-pascal wrote: > > A "make all" in the top level directory should suffice (yes, that will build all of FPC, but that is at least more or less guaranteed to work). You can then pick the pas2js binary from the utils/pas2js/bin directory. > where will that output the actual compiler to since I’m building everything now? I’d like to not override any existing installations if possible.

Nothing will be overridden as long as you do not run 'make install'

utils/pas2js/bin will contain the binaries.

Michael.

Reply by email

Ryan Joseph
to Sven Barth: Ryan Joseph schrieb am Do., 3. Mai 2018, 04:54: A "make all" in the top level directory…
On May 3, 2018, at 12:53 PM, Sven Barth via fpc-pascal wrote: A "make all" in the top level directory should suffice (yes, that will build all of FPC, but that is at least more or less guaranteed to work). You can then pick the pas2js binary from the utils/pas2js/bin directory.

Make all built the compiler but I didn’t get a /bin directory in pas2js for some reason. I tried using “make clean” and tried again but still nothing. Any ideas?

Ryans-MacBook-Pro:pas2js ryanjoseph$ ls /Developer/ObjectivePascal/fpc/utils/pas2js Makefile docs pas2js.pp
Makefile.fpc fpmake.lpi pas2jslib.lpi
compileserver.lpi fpmake.pp pas2jslib.pp
compileserver.pp httpcompiler.pp samples
dirwatch.pp pas2js.cfg
dist pas2js.lpi

Start compiling package pastojs for target i386-darwin. Compiling pastojs/src/fppas2js.pp
Compiling pastojs/src/fppjssrcmap.pp
Compiling pastojs/src/pas2jsfilecache.pp
Compiling pastojs/src/pas2jslogger.pp
Compiling pastojs/src/pas2jsfileutils.pp
Compiling pastojs/src/pas2jsfiler.pp
Compiling pastojs/src/pas2jspparser.pp
Compiling pastojs/src/pas2jscompiler.pp
Compiling pastojs/src/pas2jslibcompiler.pp
[ 96%] Compiled package pastojs

Regards,
Ryan Joseph

Reply by email

Joost van der Sluis
to Ryan Joseph: So I need to build the entire compiler and I get pas2js in the end? I didn’t realize it…

Op 02-05-18 om 11:28 schreef Ryan Joseph:

So I need to build the entire compiler and I get pas2js in the end? I didn’t realize it was built on the entire FPC compiler but I guess that makes sense.

Actually this makes no is a separate product that we should be able to distribute separately from the compiler.

I'm working on a solution. I have it even finished, but only for fpc-trunk. I thought it would be better to let it gain momentum before porting it to fpc 3.0.4, but now you convinced me that adding it to 3.0.4 also could help gaining momentum.

I hope I can finish it for fpc 3.0.4 in a few days. Then you can simply install the latest pas2js version, without having to update the whole of FPC.

Regards,

Joost.

Reply by email

Joost van der Sluis
to Ryan Joseph: Make all built the compiler but I didn’t get a /bin directory in pas2js for some…

Op 03-05-18 om 11:00 schreef Ryan Joseph:

> A "make all" in the top level directory should suffice (yes, that will build all of FPC, but that is at least more or less guaranteed to work). You can then pick the pas2js binary from the utils/pas2js/bin directory. > Make all built the compiler but I didn’t get a /bin directory in pas2js for some reason. I tried using “make clean” and tried again but still nothing. Any ideas?

Seems like it that pas2js is not included in a default build.

Change the current directory to utils/pas2js, then do 'make all'.

Regards,

Joost.

Reply by email

Ryan Joseph
to Joost van der Sluis: Op 03-05-18 om 11:00 schreef Ryan Joseph: Seems like it that pas2js is not included in a…
On May 3, 2018, at 8:26 PM, Joost van der Sluis wrote: Change the current directory to utils/pas2js, then do 'make all'.

That’s what I tried first but was told to do it on the top level directory.

There’s the error I get. Maybe I need to trash entire directory and start fresh?

Ryans-MacBook-Pro:pas2js ryanjoseph$ make all
/usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib/units/i386-darwin -Fu../../packages/fcl-process/units/i386-darwin -Fu../../packages/hash/units/i386-darwin -Fu../../packages/libtar/units/i386-darwin -Fu../../packages/fpmkunit/units/i386-darwin PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu PPU Invalid Version 200
Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted
make: *** [fpmake] Error 1

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Joost van der Sluis: Op 02-05-18 om 11:28 schreef Ryan Joseph: Actually this makes no is a separate product…
Joost van der Sluis wrote 7 lines
Op 02-05-18 om 11:28 schreef Ryan Joseph: > So I need to build the entire compiler and I get pas2js in the end? I didn’t realize it was built on the entire FPC compiler but I guess that makes sense. Actually this makes no is a separate product that we should be able to distribute separately from the compiler.

We do so, Mattias always posts an announcement with a link to the latest version.

Show quoted text 5 lines
I'm working on a solution. I have it even finished, but only for fpc-trunk. I thought it would be better to let it gain momentum before porting it to fpc 3.0.4, but now you convinced me that adding it to 3.0.4 also could help gaining momentum.

You can perfectly build it with 3.0.4, just as you can build fpReport with 3.0.4 and quite some other things.

The problem is just 1 call: a missing addLibrary in 3.0.4, which prevents fpmake.pp from compiling.

Copying fpmkunit from trunk would also have done the job.

That said, making it even more easy to compile/install it is a welcome improvement.

Michael.

Reply by email

Michael Van Canneyt
to Ryan Joseph: But doesn’t it extend the existing compiler to gain access to the parser? Ryan Joseph
Ryan Joseph wrote 7 lines
> On May 3, 2018, at 8:23 PM, Joost van der Sluis wrote: > > Actually this makes no is a separate product that we should be able to distribute separately from the compiler. But doesn’t it extend the existing compiler to gain access to the parser?

No. It uses the parser from the documentation generator.

That is why it includes the fcl-passrc etc. packages from trunk through svn:external links.

Michael.

Reply by email

Ryan Joseph

Are there any other ideas I could try to get this working? No idea why the PPU version is wrong after a totally clean build (i.e. trashed the entire directory and recompiled). If another Mac user has a binary they could upload that would be nice also.

Show quoted text 15 lines
On May 4, 2018, at 8:41 AM, Ryan Joseph wrote: Is this a Mac problem I’m having? I downloaded new sources, did a make all in the top level and make all again in pas2js. The last few lines are the make all for the compiler which ends without error then I cd to /utils/pas2js and make all again. Same error on the invalid PPU. [100%] Compiled package utils-unicode /bin/echo Build > build-stamp.i386-darwin /bin/echo Build > base.build-stamp.i386-darwin Ryans-MacBook-Pro:fpc ryanjoseph$ cd /Developer/ObjectivePascal/fpc/utils/pas2js Ryans-MacBook-Pro:pas2js ryanjoseph$ make all /usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib/units/i386-darwin -Fu../../packages/fcl-process/units/i386-darwin -Fu../../packages/hash/units/i386-darwin -Fu../../packages/libtar/units/i386-darwin -Fu../../packages/fpmkunit/units/i386-darwin PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu PPU Invalid Version 200 Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [fpmake] Error 1

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph

IMO the simplest solution for you is to use the pas2js repo:

Remove the line in fpMake.pp that adds the library. Run make all.

You will not have the library version of the compiler, but the rest should be compiled: command-line compiler and web compiler.

Michael.

Ryan Joseph wrote 24 lines
Are there any other ideas I could try to get this working? No idea why the PPU version is wrong after a totally clean build (i.e. trashed the entire directory and recompiled). If another Mac user has a binary they could upload that would be nice also. > On May 4, 2018, at 8:41 AM, Ryan Joseph wrote: > > Is this a Mac problem I’m having? I downloaded new sources, did a make all in the top level and make all again in pas2js. The last few lines are the make all for the compiler which ends without error then I cd to /utils/pas2js and make all again. Same error on the invalid PPU. > > [100%] Compiled package utils-unicode > /bin/echo Build > build-stamp.i386-darwin > /bin/echo Build > base.build-stamp.i386-darwin > Ryans-MacBook-Pro:fpc ryanjoseph$ cd /Developer/ObjectivePascal/fpc/utils/pas2js > Ryans-MacBook-Pro:pas2js ryanjoseph$ make all > /usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib/units/i386-darwin -Fu../../packages/fcl-process/units/i386-darwin -Fu../../packages/hash/units/i386-darwin -Fu../../packages/libtar/units/i386-darwin -Fu../../packages/fpmkunit/units/i386-darwin > PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu > PPU Invalid Version 200 > Fatal: Can't find unit system used by fpmake > Fatal: Compilation aborted > make: *** [fpmake] Error 1 Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Ryan Joseph
to Michael Van Canneyt
You mean this line: PT:=P.Targets.AddLibrary('pas2jslib.pp’);?

I removed that line but if I do a “make all” in the /utils/pas2js directory I still get this error. I remember getting this in the past before and doing a clean install seem to fix it but not this time. The file system.ppu is the culprit but that was built from the original make all on the top directory.

/usr/local/bin/ppc386 fpmake.pp -n -Fu../../rtl/units/i386-darwin -Fu../../packages/paszlib/units/i386-darwin -Fu../../packages/fcl-process/units/i386-darwin -Fu../../packages/hash/units/i386-darwin -Fu../../packages/libtar/units/i386-darwin -Fu../../packages/fpmkunit/units/i386-darwin PPU Loading /Developer/ObjectivePascal/fpc/rtl/units/i386-darwin/system.ppu PPU Invalid Version 200
Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted

Show quoted text 10 lines
On May 8, 2018, at 12:55 PM, Michael Van Canneyt wrote: IMO the simplest solution for you is to use the pas2js repo: Remove the line in fpMake.pp that adds the library. Run make all. You will not have the library version of the compiler, but the rest should be compiled: command-line compiler and web compiler. Michael.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote
You mean this line: PT:=P.Targets.AddLibrary('pas2jslib.pp’);?

Yes.

I removed that line but if I do a “make all” in the /utils/pas2js directory I still get this error. I remember getting this in the past before and doing a clean install seem to fix it but not this time. The file system.ppu is the culprit but that was built from the original make all on the top directory.

Yes, but do not do this in the utils/pas2js directory.

Do a checkout of the pas2js repo, and in the toplevel fpmake.pp, remove the line with AddLibrary.

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
On May 8, 2018, at 6:47 PM, Michael Van Canneyt wrote: Do a checkout of the pas2js repo, and in the toplevel fpmake.pp, remove the line with AddLibrary.

Ok it finally worked. The fpmake.pp file at https://svn.freepascal.org/svn/projects/pas2js/trunk was totally different than the one in the compiler sources.

May I suggest you put these instructions at the top level of the wiki? It’s pretty easy but I wasn’t able to build it for literally days and could have easily given up.

Something like that would have been really helpful:

1) svn co https://svn.freepascal.org/svn/projects/pas2js/trunk
2) cd trunk (or rename to pas2js)
3) modify fpmake.pp as explained
4) make all

What did I lose removing AddLibrary btw?

Regards,
Ryan Joseph

Reply by email

Ryan Joseph
to Ryan Joseph
On May 9, 2018, at 8:41 AM, Ryan Joseph wrote: Ok it finally worked.

Making progress but the wiki is incomplete I think. I figured out how to add the rtl with -Fu but I’m getting an error. What’s wrong with that name? Can you show an example of a working command line?

./pas2js -Jc -Jirtl.js -Tbrowser -Fu/Developer/pas2js/packages/rtl /Users/ryanjoseph/Downloads/hello.pas Fatal: Compilation aborted
invalid custom JS file name "rtl.js"

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 9 lines
> On May 9, 2018, at 8:41 AM, Ryan Joseph wrote: > > Ok it finally worked. Making progress but the wiki is incomplete I think. I figured out how to add the rtl with -Fu but I’m getting an error. What’s wrong with that name? Can you show an example of a working command line? ./pas2js -Jc -Jirtl.js -Tbrowser -Fu/Developer/pas2js/packages/rtl /Users/ryanjoseph/Downloads/hello.pas

The above should be fine. It may be easier to use a config file, though.

Fatal: Compilation aborted invalid custom JS file name "rtl.js"

Where is the rtl.js file ? is it in /Developer/pas2js/packages/rtl ? it should be in one of the directories specified with -Fu.

my .pas2js.cfg config file contains the following: -Fu/home/michael/projects/pas2js/packages/rtl
-Fu/home/michael/projects/pas2js/packages/*

And I have symlinked rtl.js (available in compiler/utils/pas2js/dist/) in directory /home/michael/projects/pas2js/packages/rtl, so the compiler will always find it.

Michael.

Reply by email

Mattias Gaertner
to Ryan Joseph: Making progress but the wiki is incomplete I think. I figured out how to add the rtl with…
Show quoted text 9 lines
> On May 9, 2018, at 8:41 AM, Ryan Joseph wrote: > > Ok it finally worked. Making progress but the wiki is incomplete I think. I figured out how to add the rtl with -Fu but I’m getting an error. What’s wrong with that name? Can you show an example of a working command line? ./pas2js -Jc -Jirtl.js -Tbrowser -Fu/Developer/pas2js/packages/rtl /Users/ryanjoseph/Downloads/hello.pas Fatal: Compilation aborted invalid custom JS file name "rtl.js"

It means file not found. I will change the error message.

The -Ji option searches in the unit search path. In the svn the rtl.js is only in "compiler/utils/pas2js/dist/rtl.js". So you need to add a -Fu.
In the release it is in "packages/rtl/rtl.js" as well, so it can be found without an extra -Fu.

Mattias

Reply by email

Ryan Joseph
to Michael Van Canneyt: The above should be fine. It may be easier to use a config file, though. Where is the…
On May 9, 2018, at 1:20 PM, Michael Van Canneyt wrote: Where is the rtl.js file ? is it in /Developer/pas2js/packages/rtl ? it should be in one of the directories specified with -Fu.

I misunderstood the wiki I guess. I thought that command was supposed to generate the file for you. It’s just a little auxiliary file we need with every .html file generated right?

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 8 lines
> On May 9, 2018, at 1:20 PM, Michael Van Canneyt wrote: > > Where is the rtl.js file ? is it in /Developer/pas2js/packages/rtl ? it > should be in one of the directories specified with -Fu. I misunderstood the wiki I guess. I thought that command was supposed to generate the file for you. It’s just a little auxiliary file we need with every .html file generated right?

Yes. It contains some basic functionality that the compiler relies on.

Michael.

Reply by email

Ryan Joseph
to Mattias Gaertner: On Wed, 9 May 2018 09:03:29 +0700 It means file not found. I will change the error…
Show quoted text 7 lines
On May 9, 2018, at 1:25 PM, Mattias Gaertner wrote: The -Ji option searches in the unit search path. In the svn the rtl.js is only in "compiler/utils/pas2js/dist/rtl.js". So you need to add a -Fu. In the release it is in "packages/rtl/rtl.js" as well, so it can be found without an extra -Fu.

Ok got it working now finally. Now I need to learn how to do anything at all besides writeln. :)

1) can the script output the required .html file also? I don’t see the reason do this manually each time
2) 1200 lines for a 1 line hello world program? Seems a little steep so maybe I did something wrong?

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph
Ryan Joseph wrote 13 lines
> On May 9, 2018, at 1:25 PM, Mattias Gaertner wrote: > > The -Ji option searches in the unit search path. In the svn the rtl.js > is only in "compiler/utils/pas2js/dist/rtl.js". So you need to add a > -Fu. > In the release it is in "packages/rtl/rtl.js" as well, so it can be > found without an extra -Fu. Ok got it working now finally. Now I need to learn how to do anything at all besides writeln. :) 1) can the script output the required .html file also? I don’t see the reason do this manually each time

No. The IDE does this for you, ij you install the pas2js_dsgn package.

The compiler just compiles. No more, no less.

2) 1200 lines for a 1 line hello world program? Seems a little steep so maybe I did something wrong?

See the FAQ section in the WIKI :)

Michael.

Reply by email

Ryan Joseph
to Ryan Joseph: Ok got it working now finally. Now I need to learn how to do anything at all besides…
On May 9, 2018, at 1:46 PM, Ryan Joseph wrote: Ok got it working now finally. Now I need to learn how to do anything at all besides writeln. :)

Finally got a context open and working. Next things:

1) what’s the best way to handle long strings? in JS they’ll loading text from divs but i’d rather do that from a file since long strings in Pascal aren’t great. How does that work?

2) what’s the deal with arrays? I saw there is array of xxx syntax for dynamic arrays. Can we use static arrays also and do they work with new Float32Array(xxx)? I guess all JS arrays are the same and I can pass them like

3) how does the syntax “new Float32Array()” translate to Pascal? There’s no generic class allocator syntax in Pascal so what do we use?

4) in functions from webgl that return strings the type is “JSValue”. How do those work with “string” in Pascal now? Maybe just typecast to string?

====

uses BrowserConsole, Web, WebGL;
const
	kWidth = 100;
	kHeight = 100;
var
  canvas: TJSHTMLCanvasElement;
  gl: TJSWebGLRenderingContext;
begin
  canvas := TJSHTMLCanvasElement(document.createElement('canvas'));
  canvas.width := kWidth;
  canvas.height := kHeight;
	document.body.appendChild(canvas);
	gl := TJSWebGLRenderingContext(canvas.getContext('webgl'));
	if gl = nil then
		begin
			writeln('failed to load webgl!');
			exit;
		end;
	gl.clearColor(1, 0, 0, 1);
	gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
	gl.clear(gl.COLOR_BUFFER_BIT);
end.

Regards,
Ryan Joseph

Reply by email

Michael Van Canneyt
to Ryan Joseph: Finally got a context open and working. Next things: 1) what’s the best way to handle…
Ryan Joseph wrote 9 lines
> On May 9, 2018, at 1:46 PM, Ryan Joseph wrote: > > Ok got it working now finally. Now I need to learn how to do anything at all besides writeln. :) Finally got a context open and working. Next things: 1) what’s the best way to handle long strings? in JS they’ll loading text from divs but i’d rather do that from a file since long strings in Pascal aren’t great. How does that work?

What do you mean by this ? "long strings in pascal aren't great".

What do you want to achieve ?

2) what’s the deal with arrays? I saw there is array of xxx syntax for dynamic arrays. Can we use static arrays also and do they work with new Float32Array(xxx)? I guess all JS arrays are the same and I can pass them like

You can use static arrays.

3) how does the syntax “new Float32Array()” translate to Pascal? There’s no generic class allocator syntax in Pascal so what do we use?
var
   a : TJSFloat32Array;
begin
   a:=TJSFloat32Array(TJSFloat32Array.From(something))
end;

I will see about introducing some things to make this easier.

4) in functions from webgl that return strings the type is “JSValue”. How do those work with “string” in Pascal now? Maybe just typecast to string?

Yes. Note that if they return JSValue, it means that the return type can also be different from string.

Michael.

Reply by email

Joost van der Sluis
to Ryan Joseph: Ok it finally worked. The fpmake.pp file at https://svn.freepascal.org/svn/projects/pas2js…

Op 09-05-18 om 03:41 schreef Ryan Joseph:

Show quoted text 5 lines
Ok it finally worked. The fpmake.pp file athttps://svn.freepascal.org/svn/projects/pas2js/trunk was totally different than the one in the compiler sources. May I suggest you put these instructions at the top level of the wiki? It’s pretty easy but I wasn’t able to build it for literally days and could have easily given up. Something like that would have been really helpful:

It took more time then I thought, but finally got it working.

I've added a fppkg-repository for fpc-version 3.0.4 to fpc.cnoc.nl. And added a recent version of utils-pas2js. (Which is the actual package-name of pas2js)

In principle this means that you can install pas2js with the following command-line:

fppkg install utils-pas2js

Then the pas2js binary will be in ~/.fppkg/bin/pas2js.

There are a few buts, though:
- You need a valid fppkg-configuration
- You need to set in your fppkg.cfg:
RemoteMirrors=http://fpc.cnoc.nl/repo/testing/mirrors.xml
- Fppkg wil not automatically update packages, but you need updated versions of fcl-web, fcl-js and fcl-passrc. This means you have to update them manually:
fppkg install fcl-js fcl-passrc fcl-web
- Fppkg version 3.0.4 has an irritating bug that it can get into an infinite loop. When this happens, kill it (ctrl-c) and run fppkg fixbroken
until it does not happen anymore.

I've only tested it on my own system, so there might be issues but just ask, see if I can help.

Regards,

Joost

Reply by email