Jump to navigation Jump to search


Sets the depth value used for 3D rendering. When drawing takes place in 3D, generally a depth buffer (or Z-buffer) is used to sort the distance each pixel is on the screen to the current projection, when a new pixel is rendered if only copies to the screen if it has a low distance to the camera (a lower depth). The same concept applies in the draw order of 2D objects who make proper use of their depth constant.


Parameter Data Type Description
depth double The depth value to set for drawing.

Return Values

void: This function does not return anything.

Example Call

// This demonstrates setting the depth higher than the obj_player object by an increment of 1 and then rendering a cube. This basically means were trying to draw the cube before the player.
d3d_set_depth(obj_player.depth + 1);
d3d_draw_block(-20, -20, -20, 20, 20, 20, background_get_texture(bg_example), 1, 1);