Global ark_blur_image, ark_blur_texture, ark_blur_texture1, ark_sw, ark_sh,spr2,spr3,spr4,spr5,glowcam,glowsize=256
Function CreateBlurImage(cam)
ark_sw = GraphicsWidth()
ark_sh = GraphicsHeight()
If GraphicsWidth()=1024 sprp#=.002
If GraphicsWidth()=800 sprp#=.0025
If GraphicsWidth()=640 sprp#=.003
;Create sprite
ark_blur_image = CreateMesh(cam)
Local sf = CreateSurface(ark_blur_image)
AddVertex sf, -1, 1, 0, 0, 0
AddVertex sf, 1, 1, 0, 1, 0
AddVertex sf, -1, -1, 0, 0, 1
AddVertex sf, 1, -1, 0, 1, 1
AddTriangle sf, 0, 1, 2
AddTriangle sf, 3, 2, 1
EntityFX ark_blur_image, 1
ScaleMesh ark_blur_image, 2048.0 / Float(ark_sw), 2048.0 / Float(ark_sw), 1
PositionEntity ark_blur_image, -sprp+0, sprp+0, 2.000
EntityOrder ark_blur_image, -2
EntityBlend ark_blur_image,1
ark_blur_image = ark_blur_image
;Create blur texture
ark_blur_texture = CreateTexture(ark_sw, ark_sw,256)
EntityTexture ark_blur_image, ark_blur_texture
TextureBlend ark_blur_texture,1
EntityAlpha ark_blur_image,0
HideEntity ark_blur_image
End Function
Function UpdateBlur(cam,power#)
If power#>0
EntityAlpha ark_blur_image,power#
ShowEntity ark_blur_image
CopyRect *ark_sw / 2 - 512, ark_sh / 2 - 512, 1024, 1024, 0, 0, BackBuffer(), TextureBuffer(ark_blur_texture)
Else
EntityAlpha ark_blur_image,power#
HideEntity ark_blur_image
EndIf
End Function