[fpc-pascal] pas2js Webgl unit committed

Michalis Kamburelis michalis.kambi at gmail.com
Tue May 1 18:04:30 CEST 2018


Ryan Joseph <ryan at thealchemistguild.com> wrote:

>
>
> > On May 1, 2018, at 9:56 PM, Michael Van Canneyt <michael at freepascal.org>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180501/08fc72a1/attachment.html>


More information about the fpc-pascal mailing list