Playing games on mobile devices is a fun pastime. Up until now, hardware performance has favored classic game concepts that use addictive game play, but simple graphics. Today, Tetris and Pac-Man are increasingly complemented by two-dimensional action games with extensive graphics. Consequently, the next step is to move toward 3D graphics. Sony's PlayStation Portable shows the graphics power you can put into a mobile device. Although the average mobile phone is technologically behind this specialized game machine, you can see where the market is heading. The Mobile 3D Graphics API (M3G for short), defined in Java Specification Request (JSR) 184, is an industry effort to create a standard 3D API for mobile devices that support Java programming.
M3G's API can be divided roughly into two parts: immediate and retained mode. In immediate mode, you render individual 3D objects. In retained mode, you define and display an entire world of 3D objects, including information on their appearance. You can imagine immediate mode as the low-level access to 3D functions, and retained mode as a more abstract, but also more comfortable, way of displaying 3D graphics. In this article, I'll explain the immediate mode APIs. The second part of this series shows how to use retained mode.
Alternatives to M3G
M3G is not alone. HI Corporation's Mascot Capsule API is popular in Japan, where all three major operators use it in different incarnations, and abroad. Sony Ericsson, for example, ships phones with both M3G and HI Corporation's proprietary API. Application developers report on Sony Ericsson's Web site that Mascot Capsule is a stable and fast 3D environment.
JSR 239, Java Bindings for OpenGL ES, targets similar devices to M3G. OpenGL ES is a subset of the widely known OpenGL 3D library and is becoming the de facto standard for native 3D implementations on constraint devices. JSR 239 defines a Java API that resembles OpenGL ES's C interface as much as possible, making it easy to port existing OpenGL content. As of September 2005, JSR 239 is still in early draft status. I can only speculate whether it will make any impact on mobile phones. However, while not compatible with its API, OpenGL ES did influence M3G's definition: JSR 184's expert group stipulated that it be possible to efficiently implement M3G on top of OpenGL ES. If you know OpenGL, you will recognize many M3G features.
Despite the alternatives, M3G has the support of all the major phone manufacturers and operators. Although I've mentioned games as the main attraction, M3G is a general-purpose API that you can use to create all kinds of 3D content. It will be the 3D API to use for mobile phones for years to come.