Monday, September 22, 2014

OpenGL ES from Smalltalk on Android

Well, here's my first rendering of an OpenGL scene from Smalltalk on the Android:

It's your standard plain colored triangle on a plain background - so shoot me.  But this image was generated by calling OpenGL primitives from my Smalltalk VM on an Android device, so it's pretty special.

I've talked about this Smalltalk before here.  Here's the current status.  I have all of the same bytecodes as VisualWorks implemented with the exception of the bytecode for thisContext. This allows me to use the VisualWorks compiler for free.

My source code is kept in a Store package in a separate namespace.  To run the code, I package all the classes and methods from that package into an image file in my own format - the Android image isn't compatible with a standard VW image.  This image is added as an asset in an Android project and sent along with a .so shared object library for the VM where it runs on the Android.

There's no Java code in the project at all.  I'm using a native activity in C and I've merged the Android event loop into the Smalltalk interpreter loop.  This allows me to handle events from the Android although I currently don't have code for that.

For debugging purposes, I can package a development image.  On startup, this image connects by a socket connection to a VW application which I wrote to provide low-level debugging and stepping instructions.

The system is still in its infancy.  There are still lots of things to develop like the garbage collector and most of the class library.  I have some basic operations but there's a lot of work needed to build up the library.  So far I don't have large integers although that's in the works.  I do support Float and Double and these classes are being used to help build the OpenGL image above.

I'll be demoing this system at Camp Smalltalk in Vancouver.  I'd be happy to answer questions about it.  It still needs a lot of work, but it's starting to produce real results.

No comments:

Post a Comment