DxCreateShader: Difference between revisions
Jump to navigation
Jump to search
m (moved CreateShader to DxCreateShader: Function renamed) |
No edit summary |
||
Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element | element dxCreateShader ( string filepath ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 30: | Line 30: | ||
function() | function() | ||
if not myShader then | if not myShader then | ||
myShader = | myShader = dxCreateShader( "fancything.fx" ) -- Create shader | ||
else | else | ||
destroyElement( myShader ) | destroyElement( myShader ) -- Destroy shader | ||
myShader = nil | myShader = nil | ||
end | end |
Revision as of 11:55, 13 June 2011
Only available in 1.1 This function creates a shader element that can be used in the dxDraw functions
Syntax
element dxCreateShader ( 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 = dxCreateShader( "fancything.fx" ) -- Create shader else destroyElement( myShader ) -- Destroy shader myShader = nil end end )
See Also
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsSize
- dxGetPixelsFormat
- dxGetStatus
- dxGetTextSize
- dxGetTextWidth
- dxGetTexturePixels
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderValue
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource