Game Development Reference
In-Depth Information
• It takes care of the nitty-gritty for us, such as initializing the display and
texture management, in a similar way to the IwGL API.
• It allows us to use features such as texture mapping and flat or gouraud
shading on arbitrary polygons.
• It provides some debugging functionality, such as simple text rendering
(as in our "Hello World" project) and rendering shapes like rectangles
and circles.
• It makes targeting OpenGL ES 2.x devices much easier, as it provides the
necessary shader programs to emulate the fixed function pipeline of Open
GL ES 1.x while still allowing us to provide our own custom shaders when
we want to.
By using IwGx for rendering 2D graphics from the start, we will find it a whole
lot easier to move on to drawing 3D polygons later, as the techniques involved are
incredibly similar.
With Version 6.1 of Marmalade, the IwGx API underwent a little
modernization and standardized using floating point values for
specifying polygon information. Prior to this version, some information
(for example, texture UV values) was specified in fixed point integer
formats. There was also a software-based rendering engine for targeting
old devices with no GPU hardware. If you have existing code that still
needs the old fixed point way of doing things, you can revert back by
adding define IW_USE_LEGACY_MODULES to the project MKB file.
It should come as no surprise by now that we can use IwGx in our project simply by
adding iwgx to the subprojects section of the MKB file.
Using IwGx to render 2D graphics
Now that we know how to load resources, we can get on with the fun stuff. We're
going to look at how we can draw a bitmapped image on screen.
IwGx initialization and termination
We've already seen how to do this in the "Hello World" project of Chapter 1 , Getting
Started with Marmalade . We just call IwGxInit to set up IwGx at the start of our
program and IwGxTerminate to close it down again at the end.
 
Search WWH ::




Custom Search