- Forward


3D Graphics in J2ME
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Overview
Back SMYC Forward
  • Immediate Mode:
    • "Low level" API similar to OpenGL for Embedded Systems (OpenGL ES)
    • Objects are rendered directly
  • Retained Mode:
    • "High level" API similar to Java3D
    • Works with scene graphs
Immediate Mode - Rendering Engine
Back SMYC Forward
  • Obtaining:
    • The Graphics3D class has a getInstance() method that returns the singleton Graphics3D object
  • Important Methods:
    • The render() method renders a VertexBuffer containing a shape
    • The setCamera() method is used to set the position of the viewer
    • The setLight() method is used to bind/unbind lights
Immediate Mode - Important Classes
Back SMYC Forward
  • VertexArray:
    • A VertexArray contains positions, colors, normals, or texture coordinates for vertices
  • VertexBuffer:
    • A VertexBuffer holds references to the VertexArray objects (one of each "type") needed to define a shape
  • Transform:
    • 4x4 matrix of floating point values
  • Camera:
    • The position of the viewer
Immediate Mode - Important Classes (cont.)
Back SMYC Forward
  • Material:
    • Information about the material properties (e.g., ambient color, specular color)
  • Texture2D:
    • Texture information
  • Appearance:
    • Contains a Material object, Texture2D object, etc...
  • Light:
    • A light source (e.g., ambient, directional, spot)
Immediate Mode - An Example
Back SMYC Forward

The Rendering Process

j2meexamples/src/java3d/CubeCanvas.java
 
Immediate Mode - An Example (cont.)
Back SMYC Forward

The MIDlet

j2meexamples/src/drivers/CubeDriver.java
 
Retained Mode
Back SMYC Forward
  • The Root Node:
    • The World class
  • A "Grouping" Node:
    • The Group class
  • Shapes, Lights, Materials, Appearances, Transforms:
    • Use the same classes as in immediate mode
  • Animation:
    • AnimationController
    • AnimationTrack
    • KeyframeSequence
There's Always More to Learn
Back -