DxCreateShader: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
No edit summary  | 
				No edit summary  | 
				||
| Line 5: | Line 5: | ||
}}  | }}  | ||
This function creates a [[shader]] element that can be used in the dxDraw functions.  | This function creates a [[shader]] element that can be used in the dxDraw functions.  | ||
Note that successful shader creation is not guaranteed unless the [[shader|Effect File]] contains a fallback technique which will work on every PC in the universe. You should always check to see if this function has returned false.  | |||
==Syntax==    | ==Syntax==    | ||
| Line 12: | Line 14: | ||
===Required Arguments===    | ===Required Arguments===    | ||
*'''filepath:''' The filepath of the shader .fx file  | *'''filepath:''' The filepath of the [[shader|shader  Effect File]](.fx) file  | ||
===Returns===  | ===Returns===  | ||
Revision as of 16:02, 14 June 2011
Only available in 1.1 This function creates a shader element that can be used in the dxDraw functions.
Note that successful shader creation is not guaranteed unless the Effect File contains a fallback technique which will work on every PC in the universe. You should always check to see if this function has returned false.
Syntax
element, string dxCreateShader ( string filepath )
Required Arguments
- filepath: The filepath of the shader Effect File(.fx) file
 
Returns
- element: A shader element if successful, false if invalid arguments were passed to the function.
 - string: The name of the technique that will be used.
 
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