Runtime environment notes

System properties

The Mobile 3D Graphics API does not have system properties in similar manner to other APIs, instead it has a set of implementation specific properties for the Graphics3D class that may vary from device to device. The properties can be queried with the Graphics3D.getProperties() method. It returns a Hashtable of the properties and their values.

Properties maxViewportWidth and maxViewportHeight were added in M3G 1.1, if the supported version of M3G is 1.0, the method returns null for these properties. Property m3gRelease is not mandated by the specification, but it is an implementation-specific property.

For more information, see getProperties() method.

Sprite3D and Background image scaling

If an Image2D has non-power-of-two width or height, the image is automatically resampled to the nearest power-of-two dimensions, or at most 256x256 pixels, when used in a Sprite3D or Background. This can increase the MIDlet’s peak memory consumption significantly and incur performance penalties if the image is dynamically updated.

Developers are strongly advised to use power-of-two images only.

This also applies to the following classes:

  • javax.microedition.m3g.Sprite3D

  • javax.microedition.m3g.Object3D

Hierarchical view frustum culling

The Mobile 3D Graphics API uses hierarchical view frustum culling, which eliminates unseen objects (those outside of the screen area) before they are rendered. The hierarchical method uses tree-like structures to cull. Culling a top level means the lower levels are not visible and therefore are not rendered. This improves performance.

  • Meshes outside of the screen area are optimized out of the rendering pipeline automatically.

  • Groups outside of the screen area are optimized out. Ensure that scenes are well organized so that meshes inside a group are close to each other in 3D space.

  • Applications may use coarse visibility optimization techniques (PVS, BSP, portals) to complement the built-in view frustum culling. Before calling the Graphics3D.render method, the application should select the larger scene portions to be rendered by toggling the on/off rendering enable flags in Groups and other scene graph nodes. Do not implement per-mesh view frustum culling in the application itself.