Dart WebGL?

403 views
Skip to first unread message

Stephane

unread,
Nov 21, 2011, 12:04:44 PM11/21/11
to General Dart Discussion
Hi,

I've just finished work on my 3d engine in JS using webgl. While
looking for ways to improve perf, I found out about the DART effort.
I've looked at some docs and the examples but none of them uses WebGL.

So, is it possible to use WebGL with Dart? Will it provide me with a
speed boost worth porting my engine to Dart? Any plan for native DART
support in FF and Safari?

I don't mind if IE doesn't support DART yet because it doesn't even
support WebGL.

Lots of question I know, thanks!
Stephane

Brendon Duncan

unread,
Nov 21, 2011, 12:56:01 PM11/21/11
to General Dart Discussion
Hi,

I'm interested in finding out about WebGL support in Dart too. Is it
fully functional?

I'm starting a project that I would like to use Dart for, but it
involves heavy use of WebGL. Should I stay away or dive in?

Thanks,
Brendon

Vijay Menon

unread,
Nov 21, 2011, 1:18:20 PM11/21/11
to Brendon Duncan, General Dart Discussion
You can find WebGL APIs here:


They should be pretty complete with respect to Chrome at least (they are auto-generated from IDL), but they are not well tested , so I cannot say much about functionality.  If you do try them and run into problems, please do file bugs.

- Vijay

Nikoh

unread,
Jan 16, 2012, 5:44:46 PM1/16/12
to General Dart Discussion
At the moment you have to use 'dart:dom' instead of 'dart:html' in
order to create the typed arrays like Float32Array, which is a bit of
a bummer as dart:html is nicer in other respects. Then once you've got
all that working, there doesn't currently seem to be a decent matrix
implementation in Dart (in JS you have glMatrix.js or the stuff in
closure library). I started having a go at translating glMatrix to
Dart but I lost the will before I could finish. I'm sure it wouldn't
take that long to do something in Dart if you were persistent.

Hopefully they'll update dart:html with new methods and add a nice
fast matrix library.

As for your original question about performance... I don't really
know, but I wouldn't expect big speed gains until the Dart VM appears
on browsers, so I wouldn't invest too heavily in that just yet. I'm
just dipping my toes in.

financeCoding

unread,
Jan 16, 2012, 9:37:19 PM1/16/12
to mi...@dartlang.org
One problem your going to currently find with WebGL in both dart:dom and dart:html is missing constructors for some WebGL related objects. I'd would suggest holding off unless I'm mistaken about the state of WebGL in those libraries :) BTW you can find a version of Float32Array in http://dart.googlecode.com/svn/branches/bleeding_edge/dart/samples/matrix/ 

Kind Regards,
Adam

Nikoh

unread,
Jan 17, 2012, 7:06:02 AM1/17/12
to mi...@dartlang.org
Oh cool, I should have looked a bit harder through the tree to find that (and the matrix class). When I was looking at glMatrix I noticed how it used typeof to use a plain JS Array when FLoat32Array was unavailable, and it hit me that I don't think there's anything like that in Dart - the ability to check if a browser supports a type and to use a different class if not. I guess that the implementations in the Dart library could handle this transparently and return a basic array when the browser didn't support it. Good if the Dart library is kept up to date with the features you want, bad if it isn't. Not really WebGL specific, and they might come up with a clever workaround. We'll see.
Reply all
Reply to author
Forward
0 new messages