What is GLGE?

GLGE is a javascript library intended to ease the use of WebGL; which is basically a native browser javascript API giving direct access to openGL ES2, allowing for the use of hardware accelerated 2D/3D applications without having to download any plugins.

The aim of GLGE is to mask the involved nature of WebGL from the web developer, who can then spend his/her time creating richer content for the web.

Get GLGE v0.9

Fork me on GitHub

Vehicle Physics in WebGL using GLGE and JigLibJS

July 25th, 2011

I finally have a nice simple implementation of vehicle physics working in GLGE. It’s not using the vehicle classes directly from jiglibflash, as they proved to be very difficult to get working correctly. Instead, it’s a new model which relies on the lower level jiblib classes. It’s slightly simpler than the original jiglibflash version to making things easier to tweak. Adding a new vehicle in GLGE is simply a matter of defining the car class, adding the wheels and then attaching the objects that are to represent them ie:

Or alternatively if you’d prefer to use the API:

In addition to car physics I’ve also added some support for fallback materials. This allows a material to be specified which will be used if the original material fails to work on a particular machine (eg, failing to compile because of too many varyings).

I’ve published a simple demo of vehicle physics in the github repo demonstrating it’s use, but I’ve also put together a more advanced demo to show what can be achieved with only a little effort:

Live Demo of Vehicle Physics

In case you are currently lacking a WebGL browser, here’s the video: