b2dApplyScreenShader

Category: Shaders

Syntax:

b2dApplyScreenShader:Void(shader:Int)


Parameters

Returns

Void



Summary

Makes a loaded screen shader active, so every following frame is drawn through it.

Takes shader (a handle from b2dLoadScreenShader).

Returns nothing.

One screen shader is active at a time; applying another replaces it. The effect persists across frames until b2dClearScreenShader is called. These are named b2d* on every target. They post-process the finished 2D frame; the earlier b3d* names were a leftover from when they sat alongside the 3D entity shaders.

View detailed documentation online



Example
Local crt:Int = b2dLoadScreenShader("CRT.glsl")
If crt = 0 Then
	Print "Shader failed to compile - see the console"
	Return 1
EndIf
b2dSetShaderFloat(crt, "0", 200.0)      ; slot 0: scanline count
b2dApplyScreenShader(crt)

While sysQuitRequested() = 0
	sysUpdateEvents()
	b2dCls()
	; ... draw the scene normally ...
	b2dFlip()
Wend
b2dFreeScreenShader(crt)

BambooBasic © 2026 Michael Denathorn