Graphics Programs Reference
In-Depth Information
Chapter 4
3D Modeling
In this chapter you will be introduced to modeling 3D objects using the open-source
software Blender. First, you will learn the basics of the Blender interface, and how
to model the objects for our Tank Fence game. Finally, you will see how we include
these objects inside ES 2.0 applications by using parsers to read and manipulate the
mesh data.
Drawing Shapes Using glDrawElements
To specify the type of primitive(s) we intend to render on the OpenGL surface, we use
ES 2.0 functions— glDrawArrays or glDrawElements .
In Chapter 3 you learned about the ES 2.0 function glDrawArrays . This function
is generally not used for rendering primitives in ES 2.0 applications, such as games.
This is because, when authoring game objects in 3D-modeling software, the objects
can have plenty of meshes that share vertices leading to redundant data in float
arrays for vertex positions ( Listing 4-1 ) and, consequently, redundant data in vertex
buffers ( FloatBuffer ) created using these arrays. Chapter 3 provided an example
( Chapter3/glrectangle.zip ) with redundant vertex data.
Listing 4-1. GL RECTANGLE/src/com/apress/android/glrectangle/GLES20Ren-
derer.java
 
 
Search WWH ::




Custom Search