> On May 1, 2018, at 8:28 PM, Michael Van Canneyt <mich...@freepascal.org> 
> 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

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

Reply via email to