d3d_model_create

Creates a new model and returns its index.

Syntax:

d3d_model_create()


Returns: real


Description

This function must be called before you can define a new model, and it returns the index of that model which must be stored in a variable and referenced in all further functions that you wish to use with that model. As with most created resources, when you no longer need the model you should remove it from memory by using the d3d_model_destroy function or else you will have a memory leak that will slow down and eventually crash your game.


Example:

model[2] = d3d_model_create();
d3d_model_primitive_begin(model[2], pr_trianglestrip);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_primitive_end(model[2]);

The above code will define a tetrahedron and add it to the model indexed by the variable "model[2]".


Back: 3D Models
Next: d3d_model_destroy
© Copyright YoYo Games Ltd. 2018 All Rights Reserved