Graphics Programs Reference
In-Depth Information
▪ It can collect mesh data for triangle meshes, such that this data is
ready for use with glDrawElements with mode
glDrawElements with mode GL_TRIANGLES requires a
float array with unique vertices (representing a shape) and ele-
ment indices (representing triangle meshes) for this float array.
▪ Perl parser stores unique object vertices. These vertices are listed
( Listing 4-9 ) below object name (for example, “o Plane”) as "v
vx vy vz" .
▪ Element indices are also stored. Obj format makes it easy for the
parser to find element indices, representing meshes.
▪ Face definitions ( Listing 4-9 ) "f 3 4 2" already contain vertex
indices, representing meshes. The set {3, 4, 2} represents a
triangle mesh with vertices v3, v4, and v2 ( v1 is the first
vertex that appears in .obj file, v2 is the second vertex, and so
▪ The kind of face definition this parser searches for should also
contain normal indices. Normal indices are included in face defin-
itions after double slashes. Normals are included as "vn
0.000000 0.000000 1.000000" .
▪ For advanced programming in OpenGL ES, such as the computa-
tion of shading values, this parser also stores normals correspond-
ing to the triangle meshes (that is, per-face normals).
▪ For every vertex of an object, it also calculates the normalized av-
erage of adjacent normals. This makes the shading effects smooth.
▪ The material names should be the same as that of the correspond-
ing object names.
▪ When these conditions are met, parser takes the name of Blender
file and parses the corresponding .obj and .mtl files. Finally, it
produces a text file as its output. This file contains mesh data that
can be readily used with glDrawElements with mode
Search WWH ::

Custom Search