Programmers' Toolbox

TownGL

Introduction

This a simple rendering of a set of buildings done initially for a computer graphics course back in 1999 with OpenGL 1.1 in C.

I have ported it to JavaScript with WebGL/ThreeJS, as well as, C++11 with OpenGL ES on Android.

The main goal behind the ports was to learn a bit about WebGL/ThreeJS and Android NDK.

If your browser is WebGL capable, you can play with it right away.

The WebGL version allows you to use the mouse to move the camera around. Left button rotates, while the right one translates.

A pending issue in the WebGL version is that the lights still need some configuration.

The Android version pauses when the handset screen is touched. Moving the finger changes the camera position.

As a means to ease Android debugging, the project also compiles under desktop OS like Windows.In this case you case use the parameter -w to start in windowed mode. The cursors can be used to move the camera vertically.

To pause the application use the p key.

The source code is also available on GitHub for both WebGL and Android projects.

Screenshots

Downloads

The current JavaScript source code. It includes the third party libraries it depends on.

The current C++11 source code for Android and Windows.

The example compiled for Windows with Visual Studio 2013.

The example compiled for Android Jelly Bean, targeting ARM and x86 devices.