Game Development Reference
In-Depth Information
So what exactly is the IwGL API? Put simply, it is a wrapper for OpenGL ES that
allows us to make normal OpenGL ES function calls directly, but it also provides
some other very useful functionality:
• IwGL simplifies the process of initializing OpenGL ES to a single function
call— IwGLInit . This function call will initialize the frame buffer and set
up the OpenGL context so that it is ready and raring to go, with settings
that should be optimal for the type of hardware available. Fine control over
initialization is also provided to allow display and depth buffer formats to
be chosen using settings made in the application's ICF file.
• It provides context state caching functions, such as keeping a copy of all
textures currently uploaded to OpenGL ES. In the event of your application
being suspended (for example, by an incoming call) all its textures and other
resources could be lost, and normally it would be your responsibility to
reload everything you need. IwGL automatically takes care of all this for us.
• Any OpenGL ES extension functions (extra functionality that a particular
GPU may provide over and above the required base level of OpenGL ES)
become mapped to functions that can be called directly and will not cause an
error if that function is not actually supported. Normally you would need to
specifically check if an extension exists before trying to call it.
• It also provides a Virtual Resolution system that makes it easy to take
existing code that was hardcoded to a particular resolution or screen
orientation and make it run at a different resolution or orientation by
resizing or rotating the rendered image.
IwGL is an invaluable part of the Marmalade SDK when you are porting existing
code written using OpenGL ES, as it allows you to take advantage of Marmalade's
ability to deploy to multiple platforms without having to completely recode the
entire project.
However, we won't be using IwGL in this topic either. While there is nothing to
stop us from using this API to develop a new project, it does mean we are limited to
targeting only devices that feature GPUs (or support a software emulated version of
OpenGL), and we still need to take care of things like loading textures ourselves.
You can use the IwGL API in your own project by adding iwgl to the subprojects
section of the MKB file.
 
Search WWH ::




Custom Search