Posts

Showing posts from October, 2011
Image
I translated Alexander Boswell's toy REYES renderer from C++ to Google's new Dart programming language.

Here's what the output looks like:



Try It Yourself

If your browser supports the canvas tag and JavaScript, you can see the sphere being rendered here:

Render a REYES bumpy sphere in your browser.

And the source is here: http://code.google.com/p/reyes-dart/

Translating C++ to Dart

It was pretty easy to translate the original code from C++ to Dart.
The original code made use of classes and overloaded operators, both of which are also in the Dart language.The original code used the SDL library to display output. It was easy to switch to the HTML5 CANVAS tag.
I used an early version of the "Dart Editor" IDE. The Dart Editor IDE was helpful because of the compiler warnings and errors.

Debugging

I used a variety of techniques to debug the code:
print() Dart has a built-in print function that logs to the JavaScript console. This was good for logging small amounts of data.wri…