dxCreateShader | Multi Theft Auto: Wiki Skip to content

dxCreateShader

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function creates a shader element that can be used in the dxDraw functions. Successful shader creation is not guaranteed unless the Effect File contains a fallback technique which will work on every existing PC.

Note

It is highly recommended that dxSetTestMode is used when writing and testing scripts using dxCreateShader.

Syntax

dxCreateShader ( )

Code Examples

client
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 = dxCreateShader( "fancything.fx" ) -- Create shader
else
destroyElement( myShader ) -- Destroy shader
myShader = nil
end
end
)