Jump to content

How to create full screen blur?


Restive

Recommended Posts

18 hours ago, AngelAlpha said:
local sx, sy = guiGetScreenSize()
exports.blur_box:createBlurBox( 0, 0, sx, sy, 255, 255, 255, 255, false )

 

Hi, thanks for reply. I have little problem with destroying blur box. What I did wrong in code?

addEventHandler("onClientRender", root, function() 
    local sx, sy = guiGetScreenSize()

    blur = exports.blur_box:createBlurBox( 0, 0, sx, sy, 255, 255, 255, 255, false )
    blur = exports.blur_box:setBlurIntensity(3)
end)

addEventHandler("onClientResourceStop", root, function ()
    exports.blur_box:destroyBlurBox(blur)
    removeEventHandler('onClientRender', root function()) 
end)

 

Link to comment

As far as I understand from reading the wiki, it creates a GUI element. This means that you are to treat it as any other GUI element, not like dx functions.

Basically, there's no need to render it yourself using onClientRender -> the resource does that for you.

So, what your code does is that it's creating a new GUI element on every render, that's why you're not able to destroy it. You're only storing the latest instance of that GUI element inside of the blur variable.

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...