AddScreenShader()
Syntax
AddScreenShader(Shader)Description
Adds a realtime shader to the screen. If the same shader is already set, it will replaced. Any number of shaders can be stacked on the screen. The shader effect can be controlled by ScreenShaderAttribute().
Parameters
Shader The shader to apply. It can be one of the following value: #PB_Shader_Blur : Add a blur effect to the screen. #PB_Shader_Noise : Add a noise effect to the screen. #PB_Shader_Pixelate : Add a pixelate effect to the screen. #PB_Shader_Bevel : Add a bevel effect to the screen (lighter/darker edges). #PB_Shader_BulgePinch: Add a bulge or pinch effect to the screen. #PB_Shader_Adjustment: Allow to adjust color components like red, green, blue channels, alpha value and more. #PB_Shader_Reflection: Add a screen reflection effect.
Return value
None.
Example
OpenScreen(800, 600, 32, "Shader Test") SetFrameRate(60) Procedure RenderFrame() Static Time.d DisplaySprite(0, 0, 0) ; Animate the reflection wave Time + 0.05 ScreenShaderAttribute(#PB_ReflectionShader_Time, Time) FlipBuffers() ; continue the rendering EndProcedure Procedure Loading(Type, Filename$) Static NbLoadedElements NbLoadedElements+1 If NbLoadedElements = 1 ; Finished the loading of all images and sounds, we can start the applications AddScreenShader(#PB_Shader_Reflection) ScreenShaderAttribute(#PB_ReflectionShader_Boundary, 0.80) FlipBuffers() ; start the rendering EndIf EndProcedure Procedure LoadingError(Type, Filename$) Debug Filename$ + ": loading error" EndProcedure ; Register the loading event before calling any resource load command BindEvent(#PB_Event_Loading, @Loading()) BindEvent(#PB_Event_LoadingError, @LoadingError()) BindEvent(#PB_Event_RenderFrame, @RenderFrame()) LoadSprite(0, "Data/Mountain.jpg")
See Also
RemoveScreenShader(), ScreenShaderAttribute()
Supported OS
All