d3d_set_depth(depth)
Argument | Description |
---|---|
depth | The new depth used for drawing |
Returns: N/A
Once 3D mode has been switched on you can use GameMaker: Studio as you are used to it, with the exception of certain things (see Working With 3D),
only now objects will appear in different sizes based on their depth setting. However, if you draw a number of things in a single piece of code you might want to change the depth value between the primitives
you draw, and this can be achieved using this function.
var tex;
tex = background_get_texture(back);
d3d_primitive_begin_texture(pr_trianglestrip, tex);
d3d_vertex_texture(0, 48, 0, 0, 0);
d3d_vertex_texture(64, 48,0,1,0);
d3d_vertex_texture(64, 48, 1000, 1, 1);
d3d_vertex_texture(0, 48, 1000, 0, 1);
d3d_primitive_end();
d3d_set_depth(500);
d3d_primitive_begin_texture(pr_trianglestrip, tex);
d3d_vertex_texture(80, 220, 0, 0, 0);
d3d_vertex_texture(140, 220,0,1,0);
d3d_vertex_texture(140, 220, 1000, 1, 1);
d3d_vertex_texture(80, 220, 1000, 0, 1);
d3d_primitive_end();
The above code will draw two textured primitives with a change of draw depth between them.