Overview Function List GLOD Web Site


glodInsertElements - A direct analog of the OpenGL vertex array mechanism, this takes your current GL vertex array state and uses it as a particular patch within GLOD.


void glodInsertElements(GLuint name, GLuint patchname, GLenum mode, GLuint count, GLenum type, GLvoid* indices, GLuint level, GLfloat geometric_error)


The name of the object to insert this patch into

The name of this patch. Note that patch names do not have to be sequential.

Type of primitives described by the elements. Currently supported is GL_TRIANGLES. Other triangle and polygon formats can be added given demand.

The number of vertices to draw.

The data type of the vertices in the elements array. All standard GL types are supported.

An array of the indices to be imported, in the format specified by type.

If you are manually creating a Discrete LOD object, then this parameter specifies the discrete LOD level for this patch. The finest level of a discrete object is 0. For hierarchy build types besides GLOD_DISCRETE_MANUAL, this should be set to 0.

When manually creating a Discrete LOD object, this paramater specifies the error associated with this patch. For hierarchy build types besides GLOD_DISCRETE_MANUAL, this should be set to 0.


As described in the GLOD overview, GLOD objects consist of multiple patches. These patches are inserted into GLOD using either this call or the InsertArrays call. This call behaves identically to glDrawArrays except that rather than drawing all of the enabled pointers, they are copied into GLOD for later simplification.

Following a call to this function, you can modify or delete the contents of the your pointers as you wish.

Note that:

  • You must glEnable GL_VERTEX_ARRAYS for this to function properly

  • For every pointer that you enable, including the vertex pointer, you must both
    • Enable the corresponding GL_<type_> state, using glEnableClientState

    • Call the correct gl<typePointer> function to set the pointer data and stride information


Imagine we have tighly packed arrays of 3*num_tris indices, vertices, and normals. We insert them into GLOD in the following manner:

  // provided before
  int num_tris;
  GLint* indices;
  GLfloat* vertices;
  GLfloat* normals;
  // initialize vertex arrays
  glVertexPointer(3, GL_FLOAT, 0, vertices);
  glNormalPointer(GL_FLOAT, 0, normals);
  // add them to GLOD
  glodNewObject(MY_OBJ_NAME, MY_GROUP_NAME);
  glodInsertElements(MY_OBJ_NAME, 0,
                   GL_TRIANGLES, 3*num_tris, GL_INT, indices,


GLOD_INVALID_NAME is generated if an object of the specified \c name does not exist
GLOD_INVALID_STATE is generated if this object has already been built into a hierarchy
GLOD_INVALID_DATA_FORMAT is generated if the current vertex array is in an unacceptable or unsupported format for GLOD to import from.

Last modified: 06/10/04 06:32:23 PM