Game Development Reference
In-Depth Information
In practice this API is very rarely used, partly because it provides no support for
drawing bitmapped images or lines, but mostly because it is incredibly slow on
many modern devices due to the display being drawn by a Graphics Processing
Unit ( GPU ), which may place restrictions on how and when this memory can be
accessed by the CPU.
We will not be using this API anywhere in this topic, but if you wish to use it
there is nothing you have to add to your project as it is always available in any
Marmalade project.
The IwGL API and OpenGL ES
As mentioned above, most mobile devices available today contain a GPU that is used
to speed up drawing operations and free the CPU for other tasks, such as updating
the current state of a game. The standard API that has been adopted across most
mobile platforms is OpenGL ES.
The OpenGL ES API is a derivative of the OpenGL API, which has been used on
many desktop systems for many years. OpenGL ES was conceived as a cut-down
version of OpenGL designed for embedded systems (hence the ES part of the name!).
There are two main versions of the OpenGL ES. The 1.x standard is intended for
devices that have fixed, function rendering pipelines, which means that while control
is provided in how a 3D point is transformed to 2D coordinates, and how a polygon
and its associated textures (if any) are rasterized to the screen, you are completely
limited to the options provided by the hardware.
The 2.x standard of OpenGL ES is intended for GPU hardware where the act of both
transforming 3D points and rasterizing the resultant polygons can be programmed
by way of shaders . A shader is a short program that can be applied very quickly
to either transform 3D points (a vertex shader) or work out the required color of a
rendered pixel (a pixel or fragment shader).
In most cases a device supporting OpenGL ES 2.x will also support OpenGL ES 1.x,
but the two cannot be mixed. When initializing OpenGL, you request one or the
other of these interfaces to be created as the OpenGL context. The context is really
nothing more than a big structure which stores all the information that OpenGL
needs in order to operate, such as the current frame buffer, pixel blending mode,
and available shaders.
 
Search WWH ::




Custom Search