b2dFreeScreenShader

Category: Shaders

Syntax:

b2dFreeScreenShader:Void(shader:Int)


Parameters

Returns

Void



Summary

Releases a screen shader and its GPU resources.

Takes shader (a handle from b2dLoadScreenShader).

Returns nothing.

If the shader being freed is the one currently applied, it is cleared first, so there is no need to call b2dClearScreenShader beforehand and no risk of the next frame drawing through a freed shader. 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