KX_2DFilter(BL_Shader)¶
base class — BL_Shader
-
class
bge.types.
KX_2DFilter
(BL_Shader)¶ 2D filter shader object. Can be alterated with
BL_Shader
’s functions.Warning
The vertex shader must not apply modelview and projection transformation. It should be similar to:
void main() { gl_Position = gl_Vertex; }
-
mipmap
¶ Request mipmap generation of the render bgl_RenderedTexture texture. Accessing mipmapping level is similar to:
uniform sampler2D bgl_RenderedTexture; void main() { float level = 2.0; // mipmap level gl_FragColor = textureLod(bgl_RenderedTexture, gl_TexCoord[0].st, level); }
- Type
boolean
-
offScreen
¶ The custom off screen the filter render to (read-only).
- Type
bge.types.KX_2DFilterOffScreen
or None
-
setTexture
(index, bindCode, samplerName='')¶ Set specified texture bind code
bindCode
in specified slotindex
. Any call tosetTexture
should be followed by a call toBL_Shader.setSampler
with the sameindex
ifsampleName
is not specified.- Parameters
index (integer) – The texture slot.
bindCode (integer) – The texture bind code/Id.
samplerName (string) – The shader sampler name set to
index
ifsamplerName
is passed in the function. (optional)
-
setCubeMap
(index, bindCode, samplerName='')¶ Set specified cube map texture bind code
bindCode
in specified slotindex
. Any call tosetCubeMap
should be followed by a call toBL_Shader.setSampler
with the sameindex
ifsampleName
is not specified.- Parameters
index (integer) – The texture slot.
bindCode (integer) – The cube map texture bind code/Id.
samplerName (string) – The shader sampler name set to
index
ifsamplerName
is passed in the function. (optional)
-
addOffScreen
(slots, width=- 1, height=- 1, mipmap=False)¶ Register a custom off screen to render the filter to.
- Parameters
slots (integer) – The number of color texture attached to the off screen, between 0 and 8 excluded.
width (integer) – The off screen width, -1 if it can be resized dynamically when the viewport dimensions changed (optional).
height (integer) – The off screen height, -1 if it can be resized dynamically when the viewport dimensions changed (optional).
mipmap (boolean) – True if the color texture generate mipmap at the end of the filter rendering (optional).
Note
If the off screen is created using a dynamic size (width and height to -1) its bind codes will be unavailable before the next render of the filter and the it can change when the viewport is resized.
-
removeOffScreen
()¶ Unregister the custom off screen the filter render to.
-