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)
|
PARAMETERS
- name
-
The name of the object to insert this patch into
- patchname
-
The name of this patch. Note that patch names do not have to be
sequential.
- mode
-
Type of primitives described by the elements. Currently supported is GL_TRIANGLES. Other triangle and polygon formats can be added given demand.
- count
-
The number of vertices to draw.
- type
-
The data type of the vertices in the elements array. All standard GL types are supported.
- indices
-
An array of the indices to be imported, in the format specified by type.
- level
-
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.
- geometric_error
-
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
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
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,
0,0.0);