Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

1. Using ModeMobile Graphics Hardware > The Geometry of a 3D Scene - Pg. 9

The Geometry of a 3D Scene 9 The OpenGL ES Context The information that configures OpenGL ES resides in platform-specific software data structures encapsulated within an OpenGL ES context. OpenGL ES is a state machine, which means that after a program sets a configuration value, the value remains set until the program changes the value. Information within a context may be stored in memory controlled by the CPU or in memory controlled by the GPU. OpenGL ES copies information between the two memory areas as needed, and knowing when copying happens helps to optimize programs. Chapter 9, "Optimization," describes optimization techniques. The internal implementation of OpenGL ES Contexts depends on the specific embedded system and the particular GPU hardware installed. The OpenGL ES API provides ANSI C language functions called by programs to interact with contexts so that programs don't need to know much if any system-specific information. The OpenGL ES context keeps track of the frame buffer that will be used for rendering. The context also keeps track of buffers for geometric data, colors, and so on. The context determines whether to use features such as textures and lighting, described in Chapter 3, "Textures," and Chapter 4, "Shedding Some Light." The context defines the current coordinate system for rendering, as described in the next section. The Geometry of a 3D Scene Many kinds of data, such as lighting information and colors, can be optionally omitted when supplying data to the GPU. The one kind of data that OpenGL ES must have when rendering a scene is geometric data specifying the shapes to be rendered. Geometric data is defined relative to a 3D coordinate system. Coordinate System Figure 1.6 depicts the OpenGL coordinate system. A coordinate system is an imaginary set of guides to help visualize the relationships between positions in space. Each arrow in Figure 1.6 is called an axis. OpenGL ES always starts with a rectangular Cartesian coordinate system. That means the angle between any two axes is 90 degrees. Each position in space is called a vertex, and each vertex is defined by its locations along each of three axes called X, Y, and Z.