DxCreateShader

From Multi Theft Auto: Wiki
Revision as of 15:43, 11 June 2011 by Ccw (talk | contribs) (Created page with "{{Client function}} __NOTOC__ {{New feature|3.0110|1.1| Only available in 1.1 }} This function creates a shader element that can be used in the dxDraw functions ==Syntax== <syntaxhighlight lang="lua"...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Only available in 1.1 This function creates a shader element that can be used in the dxDraw functions

Syntax

element createShader ( string filepath )

Required Arguments

  • filepath: The filepath of the shader .fx file

Returns

Returns a shader element if successful, false if invalid arguments were passed to the function.

Example

addEventHandler( "onClientRender", root,
    function()
        if myShader then
            dxDrawImage( 100, 350, 300, 350, myShader )
        end
    end
)

-- Use 'toggle' command to switch shader on and off
addCommandHandler( "toggle",
    function()
        if not myShader then
            myShader = createShader( "fancything.fx" )  -- Create shader
        else        
            destroyElement( myShader )                -- Destroy shader
            myShader = nil
        end
    end
)

See Also