io7m
io7m-jcanephora 0.45.0
3.9
JCGLDepthBuffersType

- 3.9.1. Description
- 3.9.2. Usage examples
- 3.9.3. State

3.9.1
Description
1
The JCGLDepthBuffersType interface provides functions for controlling depth testing, writing, and clamping of depth values.
3.9.2
Usage examples
1
To clear the current depth buffer to a value typical of the far clipping plane:
3.9.2.1. Depth buffer clear

    JCGLDepthBuffersType g;

    g.depthBufferClear(1.0f);

2
To discard all writes to the depth buffer (note that this will also prevent clearing of the depth buffer):
3.9.2.2. Depth buffer mask

    JCGLDepthBuffersType g;

    g.depthBufferWriteDisable();

3
To enable depth testing and set the depth function such that only depth values less than the current value in the depth buffer will be written:
3.9.2.3. Depth buffer enable

    JCGLDepthBuffersType g;

    g.depthBufferTestEnable(DepthFunction.DEPTH_LESS_THAN);

4
Most of the functions raise exceptions if attempting to perform operations on a framebuffer that does not have a depth buffer.
3.9.3
State
1
The current depth-testing and depth-writing state is global to a given context; when enabled, it is enabled for all subsequent rendering operations on that context until explicitly modified or disabled.