When you need to draw large models it is rather expensive to call all the different drawing functions again and again in every step, so to avoid this you can create models. A model consists of a number
of primitives and shapes that are all drawn together as a whole. Once a model is created you can draw it at different places with just one function call, models can also be loaded or saved to a file. Using
models can considerable speed up the graphics in your 3D games and you should use them whenever you can.
Before giving the different functions available there is one important point: the handling of textures. Textures are taken from sprites and backgrounds using the functions found in the section on
2D Primitives. The indices of the textures can be different at different moments, and as a result models do not contain any texture information. This means that
only when you draw a model do you provide the texture, so you can only use one texture in a model. If you need more textures you must either combine them in one (and carefully deal with the texture coordinates)
or you must use multiple models. The advantage of this is that you can draw the same model easily with different textures.
For creating, loading, saving, and drawing models, the following functions exist:
For each primitive function there is an equivalent to add it to a model. The functions have the same arguments as the 2D primitive functions, or the 3D normal equivalents, except that each has as a first argument
the index of the model, and no texture information is provided.
Besides primitives you can also add basic shapes to the models. Again the functions look almost the same as the drawing functions found in the 3D drawing section, but
with a model index and without texture information: