GM: d3d set depth

From GMpedia.org Wiki

Jump to: navigation, search
The correct title of this article is d3d_set_depth(depth). It appears incorrectly here because of technical restrictions.

d3d_set_depth()

Type: function
Arguments: depth = integer value
Limitations: Registered

When you are drawing multiple primitives in code, you may want to draw something at a particular depth. You can use this function to temporarily set the depth for drawing to the value you assign.

[edit] Example

d3d_set_depth(100);
// to draw 2 floors very close to each other
d3d_draw_floor(x, y, z, x+32, y+32, z, texture, 1, 1)
d3d_set_depth(depth-1)
d3d_draw_floor(x, y, z+1, x+32, y+32, z+1, texture, 1, 1)

Be aware that at the moment a new instance is drawn the depth is again set to the depth of that instance.

This article was originally found at the Game Maker Knowledge Base, contributed by monkey dude.
See the talk page for details
Personal tools