3D graphics in Resolver One using OpenGL and Tao, part I

Posted on 9 September 2009 in 3D, Programming, Resolver One

I've been playing around with 3D graphics recently, and decided to find out what could be done using .NET from inside Resolver One. (If you haven't heard of Resolver One, it's a spreadsheet made by the company I work for -- think of it as Excel on steroids :-)

I was quite pleased at what I managed with a few hours' work (click the image for video):

3D stuff

To try it out yourself:

Once you've loaded up the spreadsheet, a window will appear showing the spinning cube with the Resolver Systems logo that appears in the video. In the spreadsheet itself, the worksheet "Path" contains the list of 2,000 points that the cube follows while it spins; as in the video, these are inially all (0, 0, 0), so the cube just sits in the centre of the window spinning. To make it bounce gently, following a sine curve, enter the following column-level formula by clicking on the header of column C:

=SIN(2 * PI() * (#t#_ / 1000)) * 2.5

You can then try putting the same formula with COS instead of SIN in column B, and with TAN in column D, to get the video's zooming spiraling effect.

So, how does it work? The bulk of the clever OpenGL stuff is in the IPOpenGL.py support file. I'll discuss that in a minute, but it's worth glancing at the Resolver One side first. The post-formulae user code in the spreadsheet works like this:

So much for the user code. The IPOpenGL.py support module is a bit more complicated; there are just 314 lines, but that's still too many for a full walkthough, so I'll just give the highlights:

If you understood all of that, then you're in a great position to start building OpenGL applications driven by Resolver One data. I'll be blogging more about this in the future, so watch this space if you want more hints and tips.

If you didn't understand all of that, leave a comment below and I'll try to explain it better (and update the description if needs be)!