Cogl.DepthState¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
private_member_magic |
r |
||
private_member_padding0 |
r |
||
private_member_padding1 |
r |
||
private_member_padding2 |
r |
||
private_member_padding3 |
r |
||
private_member_padding4 |
r |
||
private_member_padding5 |
r |
||
private_member_padding6 |
r |
||
private_member_padding7 |
r |
||
private_member_padding8 |
r |
||
private_member_padding9 |
r |
||
private_member_range_far |
r |
||
private_member_range_near |
r |
||
private_member_test_enabled |
r |
||
private_member_test_function |
r |
||
private_member_write_enabled |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Cogl.DepthState¶
New in version 2.0.
- get_range(near_val, far_val)¶
- Parameters:
Gets the current range to which normalized depth values are mapped before writing to the depth buffer. This corresponds to the range set with
Cogl.DepthState.set_range
().New in version 2.0.
- get_test_enabled()¶
- Returns:
The pipeline’s current depth test enabled state.
- Return type:
Gets the current depth test enabled state as previously set by
Cogl.DepthState.set_test_enabled
().New in version 2.0.
- get_test_function()¶
- Returns:
The current depth test enable state.
- Return type:
Gets the current depth test enable state as previously set via
Cogl.DepthState.set_test_enabled
().New in version 2.0.
- get_write_enabled()¶
- Returns:
The current depth writing enable state
- Return type:
Gets the depth writing enable state as set by the corresponding
Cogl.DepthState.set_write_enabled
().New in version 2.0.
- init()¶
Initializes the members of self to their default values.
You should never pass an un initialized
Cogl.DepthState
structure toCogl.Pipeline.set_depth_state
().New in version 2.0.
- set_range(near_val, far_val)¶
- Parameters:
Sets the range to map depth values in normalized device coordinates to before writing out to a depth buffer.
After your geometry has be transformed, clipped and had perspective division applied placing it in normalized device coordinates all depth values between the near and far z clipping planes are in the range -1 to 1. Before writing any depth value to the depth buffer though the value is mapped into the range [0, 1].
With this function you can change the range which depth values are mapped too although the range must still lye within the range [0, 1].
If your driver does not support this feature (for example you are using GLES 1 drivers) then if you don’t use the default range values you will get an error reported when calling
Cogl.Pipeline.set_depth_state
(). You can check ahead of time for theCogl.FeatureID.OGL_FEATURE_ID_DEPTH_RANGE
feature withCogl.has_feature
() to know if this function will succeed.By default normalized device coordinate depth values are mapped to the full range of depth buffer values, [0, 1].
NB: this won’t directly affect the state of the GPU. You have to then set the state on a
Cogl.Pipeline
usingCogl.Pipeline.set_depth_state
().New in version 2.0.
- set_test_enabled(enable)¶
- Parameters:
enable (
int
) – The enable state you want
Enables or disables depth testing according to the value of enable.
If depth testing is enable then the
Cogl.DepthTestFunction
set usingCogl.DepthState.set_test_function
() us used to evaluate the depth value of incoming fragments against the corresponding value stored in the current depth buffer, and if the test passes then the fragments depth value is used to update the depth buffer. (unless you have disabled depth writing viaCogl.DepthState.set_write_enabled
())By default depth testing is disabled.
NB: this won’t directly affect the state of the GPU. You have to then set the state on a
Cogl.Pipeline
usingCogl.Pipeline.set_depth_state
()New in version 2.0.
- set_test_function(function)¶
- Parameters:
function (
Cogl.DepthTestFunction
) – TheCogl.DepthTestFunction
to set
Sets the
Cogl.DepthTestFunction
used to compare the depth value of an incoming fragment against the corresponding value in the current depth buffer.By default the depth test function is
Cogl.DepthTestFunction.LESS
NB: this won’t directly affect the state of the GPU. You have to then set the state on a
Cogl.Pipeline
usingCogl.Pipeline.set_depth_state
()New in version 2.0.
- set_write_enabled(enable)¶
- Parameters:
enable (
int
) – The enable state you want
Enables or disables depth buffer writing according to the value of enable. Normally when depth testing is enabled and the comparison between a fragment’s depth value and the corresponding depth buffer value passes then the fragment’s depth is written to the depth buffer unless writing is disabled here.
By default depth writing is enabled
NB: this won’t directly affect the state of the GPU. You have to then set the state on a
Cogl.Pipeline
usingCogl.Pipeline.set_depth_state
()New in version 2.0.