mjbWorld program - Geometry

This section explains how mjbWorld stores 3D shapes



Setting up the Index arrays

The shapes below are derived from geometryBean which stores all the vertex information

Issues with using Indexed arrays

When you instantiate non-indexed geometric primitive there is a one-to-one correspondence between the per-vertex component array sizes and the number of vertices used to define your geometry:

triangle = new TriangleArray(10, ....
ten verices define the Triangle array

When using an indexed primitive, the vertex count specifies the number of possible (or defined) vertices. The index count defines the actual number of vertices (drawn from the set in the per-vertex component arrays) that define the geometry. So:

itriangle = new IndexedTriangleArray(10, GeometryArray.COORDINATES, 2)
^ ^
| |
total number of verts loaded |
selecting only 2 of the 10 loaded

itriangle = new IndexedTriangleArray(10, GeometryArray.COORDINATES, 100)
^ ^
| |
total number of verts loaded |
selecting 100 from the 10 loaded

This can cause a lot of duplication duplication. If each of your vertices is the same color, and you have 100 vertices to load, then you duplicate the color 100 times.



metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Covers VRML 2 (but not the upcoming X3D standard). A good introduction to all VRML2 node types and how to build them.

cover This book introduces 3D concepts, VRML, Java3D, MPEG4/BIFS, and X3D. It is a very good introduction to the theory, The writers have an in depth knowledge due to their involvement in the standards making. This is a good book to help you choose which 3D open standards to use and to give you a good insight into these standards. It is probably not for those who want a basic introduction to 3D or for these who want a step-by-step programming in 3D book.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.