Difference between revisions of "love.graphics.setDepthMode"

m
m
 
Line 4: Line 4:
 
This is low-level functionality designed for use with custom [[love.graphics.newShader|vertex shaders]] and [[Mesh]]es with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.
 
This is low-level functionality designed for use with custom [[love.graphics.newShader|vertex shaders]] and [[Mesh]]es with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.
  
{{notice|Depth testing and depth writes will have no effect unless the ''depth'' field is set to true in a table passed to [[love.graphics.setCanvas]], or a custom Canvas with a depth [[PixelFormat]] is set in the ''depthstencil'' field in a table passed to [[love.graphics.setCanvas|setCanvas]].}}
+
 
 +
{{notice|Depth writes will not work without an active depth buffer.
 +
* When drawing to the main screen, the window's depth buffer must be enabled in [[love.conf]] or [[love.window.setMode]].
 +
* When drawing to a Canvas, the ''depth'' field must be set to true in a table passed to [[love.graphics.setCanvas]], or a custom Canvas with a depth [[PixelFormat]] must be set in the ''depthstencil'' field in a table passed to [[love.graphics.setCanvas|setCanvas]].}}
  
 
{{notice|Writing to the depth buffer is generally incompatible with rendering alpha-blended sprites / images. By default depth is determined by geometry (vertices) instead of texture alpha values, the depth buffer only stores a single depth value per pixel, and alpha blending '''requires''' back-to-front rendering for blending to be correct.}}
 
{{notice|Writing to the depth buffer is generally incompatible with rendering alpha-blended sprites / images. By default depth is determined by geometry (vertices) instead of texture alpha values, the depth buffer only stores a single depth value per pixel, and alpha blending '''requires''' back-to-front rendering for blending to be correct.}}

Latest revision as of 11:18, 14 April 2024

Available since LÖVE 11.0
This function is not supported in earlier versions.

Configures depth testing and writing to the depth buffer.

This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.


O.png Depth writes will not work without an active depth buffer.  


O.png Writing to the depth buffer is generally incompatible with rendering alpha-blended sprites / images. By default depth is determined by geometry (vertices) instead of texture alpha values, the depth buffer only stores a single depth value per pixel, and alpha blending requires back-to-front rendering for blending to be correct.  


Function

Synopsis

love.graphics.setDepthMode( comparemode, write  )

Arguments

CompareMode comparemode
Depth comparison mode used for depth testing.
boolean write
Whether to write update / write values to the depth buffer when rendering.

Returns

Nothing.

Function

Disables depth testing and depth writes.

Synopsis

love.graphics.setDepthMode( )

Arguments

None.

Returns

Nothing.

See Also


Other Languages