55
66
77class DepthTexture (BaseTexture ):
8- """Depth Texture"""
8+ """
9+ A DepthTexture is a texture for storing depth information during rendering.
10+ They are attachments to :py:class:`demosys.opengl.FBO`.
11+ """
912
1013 # Class attributes for drawing the texture
1114 quad = None
1215 shader = None
1316 sampler = None
1417
15- def __init__ (self , size , data = None , samples = 0 , alignment = 8 ):
18+ def __init__ (self , size , data = None , samples = 0 , alignment = 4 ):
1619 """
1720 Create a depth texture
1821
@@ -27,12 +30,24 @@ def __init__(self, size, data=None, samples=0, alignment=8):
2730 _init_depth_texture_draw ()
2831
2932 @classmethod
30- def create (cls , size , data = None , samples = 0 , alignment = 8 ) -> 'DepthTexture' :
33+ def create (cls , size , data = None , samples = 0 , alignment = 4 ) -> 'DepthTexture' :
34+ """
35+ Creates a :py:class:`DepthTexture` object
36+
37+ :param size: (tuple) The width and height of the texture.
38+ :param data: (bytes) Content of the texture.
39+ :param samples: The number of samples. Value 0 means no multisample format.
40+ :param alignment: The byte alignment 1, 2, 4 or 8.
41+ :return: :py:class:`DepthTexture` object
42+ """
3143 return cls (size , data = data , samples = samples , alignment = alignment )
3244
3345 def draw (self , near , far , pos = (0.0 , 0.0 ), scale = (1.0 , 1.0 )):
3446 """
3547 Draw depth buffer linearized.
48+ By default this will draw the texture as a full screen quad.
49+ A sampler will be used to ensure the right conditions to draw the depth buffer.
50+
3651 :param near: Near plane in projection
3752 :param far: Far plane in projection
3853 :param pos: (tuple) offset x, y
0 commit comments