Game Development Reference
In-Depth Information
If you are trying to draw a polygon and you just can't get it to appear,
the first thing to do is double-check the winding order of your vertices.
They may just be getting culled by the GPU and not being drawn!
Our polygon information has now been submitted for rendering; but we won't see it
appear on screen just yet.
Displaying the rendered image
The final step in making something appear on screen is to flush all the drawing
requests to the screen, and then display the final image.
IwGx automatically provides us with a double-buffered display setup. All this means
is we do all our rendering to an off-screen buffer and then switch to displaying this
buffer when all the drawing is complete. If we did not do this, we would likely see
an incomplete, flickering screen display as our graphics could be displayed in an
incomplete state if we drew straight to the visible display.
To complete the cycle of drawing, all we have to do is add the following two lines
of code:
IwGxFlush();
IwGxSwapBuffers();
That's it! We've drawn our first polygon!
Example code
If you download the code package for this chapter, you will find three projects that
illustrate the use of the Marmalade functionality we have learnt about in this chapter.
The ITX project
The ITX project demonstrates use of the ITX text parser and the CIwManaged class.
The example first creates custom instances of our own class by parsing an ITX file,
then serializes those instances out to a file. All the instances are then destroyed and
re-created by loading the serialized file back in.
The example also demonstrates the use of two more parts of the IwUtil API, which
we haven't covered in depth, but are very useful to know about. First is the class
CIwManagedList , which is used for maintaining a list of objects derived from
CIwManaged , and the second is the IwTrace system that allows us to log information
to a file (and to the standard output) in order to aid debugging.
 
Search WWH ::




Custom Search