Sampler
- class arcade.gl.Sampler(ctx: Context, texture: Texture2D, *, filter: tuple[PyGLuint, PyGLuint] | None = None, wrap_x: PyGLuint | None = None, wrap_y: PyGLuint | None = None)[source]
Bases:
OpenGL sampler object.
When bound to a texture unit it overrides all the sampling parameters of the texture channel.
- property filter: tuple[int, int]
Get or set the
(min, mag)
filter for this texture.These are rules for how a texture interpolates. The filter is specified for minification and magnification.
Default value is
LINEAR, LINEAR
. Can be set toNEAREST, NEAREST
for pixelated graphics.When mipmapping is used the min filter needs to be one of the
MIPMAP
variants.Accepted values:
# Enums can be accessed on the context or arcade.gl NEAREST # Nearest pixel LINEAR # Linear interpolate NEAREST_MIPMAP_NEAREST # Minification filter for mipmaps LINEAR_MIPMAP_NEAREST # Minification filter for mipmaps NEAREST_MIPMAP_LINEAR # Minification filter for mipmaps LINEAR_MIPMAP_LINEAR # Minification filter for mipmaps
Also see
- property wrap_x: int
Get or set the horizontal wrapping of the texture.
This decides how textures are read when texture coordinates are outside the
[0.0, 1.0]
area. Default value isREPEAT
.Valid options are:
# Note: Enums can also be accessed in arcade.gl # Repeat pixels on the y axis texture.wrap_x = ctx.REPEAT # Repeat pixels on the y axis mirrored texture.wrap_x = ctx.MIRRORED_REPEAT # Repeat the edge pixels when reading outside the texture texture.wrap_x = ctx.CLAMP_TO_EDGE # Use the border color (black by default) when reading outside the texture texture.wrap_x = ctx.CLAMP_TO_BORDER
- property wrap_y: int
Get or set the horizontal wrapping of the texture.
This decides how textures are read when texture coordinates are outside the
[0.0, 1.0]
area. Default value isREPEAT
.Valid options are:
# Note: Enums can also be accessed in arcade.gl # Repeat pixels on the x axis texture.wrap_x = ctx.REPEAT # Repeat pixels on the x axis mirrored texture.wrap_x = ctx.MIRRORED_REPEAT # Repeat the edge pixels when reading outside the texture texture.wrap_x = ctx.CLAMP_TO_EDGE # Use the border color (black by default) when reading outside the texture texture.wrap_x = ctx.CLAMP_TO_BORDER
- property compare_func: str | None
Get or set the compare function for a depth texture:
texture.compare_func = None # Disable depth comparison completely texture.compare_func = '<=' # GL_LEQUAL texture.compare_func = '<' # GL_LESS texture.compare_func = '>=' # GL_GEQUAL texture.compare_func = '>' # GL_GREATER texture.compare_func = '==' # GL_EQUAL texture.compare_func = '!=' # GL_NOTEQUAL texture.compare_func = '0' # GL_NEVER texture.compare_func = '1' # GL_ALWAYS