Game Development Reference
In-Depth Information
It is recommended that when materials are created using an MTL
file, you do not modify any of their settings using the methods in the
CIwMaterial class. Instead, make a copy of the material using the
CIwMaterial::Copy method. While it is possible to do so, problems
can occur if the same material is used to render several different things,
since rendering does not occur as soon as a drawing function call is made.
The end result is therefore unpredictable as it would depend on how the
CIwMaterial happens to be configured when rendering finally occurs.
Vertex streams
In order to display a polygon on screen, we need to specify a list of screen
coordinates that define the corner points. Since we are only rendering in 2D at the
moment, each coordinate is specified as a CIwSVec2 instance, which is a vector class
defined in another Marmalade API called IwGeom . Any list of data items used
when rendering polygons, be it vertices, colors, or whatever, is often referred to as
a stream , so a list of vertices is called a vertex stream .
While we can specify this API to be part of our project by adding iwgeom to the
subprojects section of the MKB file and calling IwGeomInit and IwGeomTerminate ,
there isn't actually a need to, since IwGx relies on this API itself.
The CIwSVec2 class defines a two-component vector using signed 16-bit integers, so
it is perfect for specifying screen coordinates.
The default screen coordinate system in IwGx places the origin at the top-left corner
of the screen, with the x component increasing horizontally to the right and the y
component increasing vertically downwards. It is possible to change the position of
the origin, however, by passing a CIwSVec2 instance containing the desired position
of the origin to the function IwGxSetScreenSpaceOrg .
 
Search WWH ::




Custom Search