Mobile 3D Graphics API
Encyclopedia
The Mobile 3D Graphics API, commonly referred to as M3G, is a specification defining an API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

 for writing Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 programs that produce 3D computer graphics
3D computer graphics
3D computer graphics are graphics that use a three-dimensional representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images...

. It extends the capabilities of the Java ME, a version of the Java platform tailored for embedded devices such as mobile phone
Mobile phone
A mobile phone is a device which can make and receive telephone calls over a radio link whilst moving around a wide geographic area. It does so by connecting to a cellular network provided by a mobile network operator...

s and PDA
Personal digital assistant
A personal digital assistant , also known as a palmtop computer, or personal data assistant, is a mobile device that functions as a personal information manager. Current PDAs often have the ability to connect to the Internet...

s. The object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 interface consists of 30 classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 that can be used to draw complex animated three-dimensional scenes. M3G was developed under the Java Community Process
Java Community Process
The Java Community Process or JCP, established in 1998, is a formalized process that allows interested parties to get involved in the definition of future versions and features of the Java platform....

 as JSR 184. , the current version of M3G is 1.1, but version 2.0 is in development as JSR 297.

Goals of M3G

M3G was designed to meet the specific needs of mobile devices, which are constricted in terms of memory, and processing power, and which often lack an FPU
Floating point unit
A floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division, and square root...

 and graphics hardware such as a GPU
Graphics processing unit
A graphics processing unit or GPU is a specialized circuit designed to rapidly manipulate and alter memory in such a way so as to accelerate the building of images in a frame buffer intended for output to a display...

. The API's architecture allows it to be implemented completely inside software
Computer software
Computer software, or just software, is a collection of computer programs and related data that provide the instructions for telling a computer what to do and how to do it....

 or to take advantage of the hardware present on the device.

M3G is not Java 3D

M3G should not be mistaken for Java 3D
Java 3D
Java 3D is a scene graph-based 3D application programming interface for the Java platform. It runs atop either OpenGL or Direct3D. Since version 1.2, Java 3D has been developed under the Java Community Process....

, which extends the capabilities of the Java SE. Java 3D is designed for PCs
Personal computer
A personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...

 that have more memory and greater processing power than mobile devices. M3G and Java 3D are two separate and incompatible APIs designed for different purposes.

Immediate and Retained Modes

M3G provides two ways for developers to draw 3D graphics: immediate mode and retained mode. In immediate mode, graphics commands are issued directly into the graphics pipeline and the rendering engine executes them immediately. When using this method, the developer must write code that specifically tells the rendering engine what to draw for each animation frame. A camera, and set of lights are also associated with the scene, but is not necessarily part of it. In immediate mode it is possible to display single objects, as well as entire scenes (or worlds, with a camera, lights, and background as parts of the scene).

Retained mode always uses a scene graph
Scene graph
A scene graph is a general data structure commonly used by vector-based graphics editing applications and modern computer games. Examples of such programs include Acrobat 3D, Adobe Illustrator, AutoCAD, CorelDRAW, OpenSceneGraph, OpenSG, VRML97, and X3D....

 that links all geometric objects in the 3D world in a tree structure
Tree structure
A tree structure is a way of representing the hierarchical nature of a structure in a graphical form. It is named a "tree structure" because the classic representation resembles a tree, even though the chart is generally upside down compared to an actual tree, with the "root" at the top and the...

, and also specifies the camera, lights, and background. Higher-level information about each object — such as its geometric structure, position, and appearance — is retained from frame to frame.

Other Features

The M3G standard also specifies a file format for 3D model data, including animation data. This allows developers to create content on PCs that can be loaded by M3G on mobile devices.

Advantages and disadvantages of M3G

M3G is a high level 3D API that allows you to get results quickly. With only a few lines of code you can import a scene and animate it. The API is intuitive and has quite sophisticated features. The down side is that it runs quite slow on a lot of mobile phones. This is mainly because it uses floats and most mobile phones do not have a processor with a floating point unit. Nevertheless, the performance can be acceptable if you optimize your program correctly (especially on newer phones). Alternative proprietary APIs such as Mascot Capsule run faster (because of its use of fixed point calculations), but aren't as widely supported.

Further reading

  • Alessio Malizia: Mobile 3D Graphics, Springer, 2006, ISBN 978-1-84628-383-3
  • Kari Pulli, Tomi Aarnio, Ville Miettinen
    Ville Miettinen
    Ville Ilmari Miettinen is a Finnish serial entrepreneur and computer programmer. Miettinen was the co-founder and CTO of...

    , Kimmo Roimela, Jani Vaarala: Mobile 3D Graphics with OpenGL ES and M3G, Morgan Kaufmann, 2007, ISBN 0-12373-727-3
  • Claus Höfele: Mobile 3D Graphics: Learning 3D Graphics with the Java Micro Edition, Thomson Course Technology PTR, 2007, ISBN 1-59863-292-2
  • Carlos Morales, David Nelson: Mobile 3D Game Development: From Start to Market, Charles River Media, 2007, ISBN 1-58450-512-5

M3G utilities


External links

  • JSR 184 (Mobile 3D Graphics API for J2ME 1.0, 1.1)
  • JSR 297 (Mobile 3D Graphics API 2.0)
  • Getting Started With the Mobile 3D Graphics API for J2ME
  • 3D graphics for Java mobile devices: Part 1 and Part 2
  • JSR 239 (Java Bindings for OpenGL
    OpenGL
    OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...

    Embedded Subset) - related Java ME graphics specification
  • JSR 184 compatible devices (Performance listing of most mobile 3D devices)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK