gpu_set_zwriteenable


描述

This function can be used to toggle on (true) and off (false) depth ordering using the z-buffer. When an instance is rendered in GameMaker Studio 2 , the depth of a generated pixel (its z coordinate) is stored in the z-buffer, then, if another instance of the scene must be rendered at the same pixel, the two depths are compared (z-testing - see gpu_set_ztestenable) and the one "closer" to the observer is then saved to the z-buffer, replacing the old one. However, this is not always what you wish to happen and there are moments when you may want something to be drawn over everything else, no matter what its z value is. In those cases you can use this function to switch off writing to the z-buffer and so force whatever is being drawn to be drawn over everything else. Note that the description given here is for the default z-testing comparison mode, but that can be changed

The default value is that z-buffering is enabled (true).


语法:

gpu_set_zwriteenable(enable);


参数:

参数 描述
enable The comparison mode to use (see list above)


返回:

N/A(无返回值)


例如:

gpu_set_zwriteenable(false);
with (obj_Menu_Containers)
   {
   draw_self();
   }
gpu_set_zwriteenable(true);

The above code switches off z-buffer writing, draws a number of objects, and then switches it back on again to continue drawing.


上一页: GPU Functions
下一页: gpu_set_fog
© Copyright YoYo Games Ltd. 2018 All Rights Reserved