Channels ▼
RSS

Mobile

Importing 3D Models into Mobile Java Devices

Source Code Accompanies This Article. Download It Now.


Key Classes and Rendering Modes

The key M3G classes involved with 3D object creation and rendering include:

  • Object geometry classes, such as VertexArray, which store the vertexes that form a 3D object's surfaces. A Mesh class contains a VertexBuffer that stores several VertexArrays used to describe complex surfaces. M3G 1.0 and 1.1 construct all surfaces with triangle strips.
  • Rendering attributes classes, which specify an object's visual characteristics. Appearance serves as a container for these other attribute classes. An instance of Appearance can share its visual information and attributes among multiple instances of a 3D object, thus conserving memory.
  • Scene-graph classes gather 3D objects into logical groups that represent 3D models (such as a robot) or assemble a complete 3D scene, say, a robot in a bar. The special classes Light and Camera determine how the scene is lit or its point of view (POV).
  • Rendering control classes execute the rendering operation. Graphics3D contains rendering methods that draw either entire scene graphs (or world) or just meshes (objects).
  • Loader reads and verifies the contents of M3G files. It parses the file's contents into instances of M3G objects. The loader can read complete 3D scenes and animation data as well as objects.

Here, I concentrate on the object geometry and rendering attributes classes because they handle the model's construction and appearance. Figure 1 illustrates how these two groups of classes display a 3D model. The Camera and Light scene-graph classes figure in all rendering operations.

[Click image to view at full size]

Figure 1: How the M3G classes describe a 3D model and its visual attributes (appearance). The M3G rendering engine uses data from these objects to generate the image.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video