DxSetRenderTarget: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Client function}} __NOTOC__ {{New feature|3.0110|1.1| Only available in 1.1 }} This function changes the drawing destination for the dx functions. It can be used to select a pr...") |
No edit summary |
||
Line 8: | Line 8: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool dxSetRenderTarget ( [ element renderTarget, bool clear = false ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
If no arguments are supplied, the screen is restored as the drawing destination. | |||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''renderTarget:''' The render target element whose pixels we want to draw on. | *'''renderTarget:''' The render target element whose pixels we want to draw on. | ||
If | *'''clear:''' If set to true, the render target will also be cleared. | ||
===Returns=== | ===Returns=== | ||
Line 30: | Line 32: | ||
if myRenderTarget then | if myRenderTarget then | ||
dxSetRenderTarget( myRenderTarget ) -- Select custom render target | dxSetRenderTarget( myRenderTarget ) -- Select custom render target | ||
dxDrawText ( "Hello", 10, 20 ) -- | dxDrawText ( "Hello", 10, 20 ) -- The message 'Hello' will be drawn on myRenderTarget | ||
dxSetRenderTarget() -- Select default render target | dxSetRenderTarget() -- Select default render target | ||
dxDrawText ( " | dxDrawText ( "Goodbye", 10, 20 ) -- The message 'Goodbye' will be drawn directly to the screen | ||
end | end | ||
end | end |
Revision as of 15:39, 14 June 2011
Only available in 1.1 This function changes the drawing destination for the dx functions. It can be used to select a previously created render target, or if called with no arguments, restore drawing directly to the screen.
Syntax
bool dxSetRenderTarget ( [ element renderTarget, bool clear = false ] )
If no arguments are supplied, the screen is restored as the drawing destination.
Optional Arguments
- renderTarget: The render target element whose pixels we want to draw on.
- clear: If set to true, the render target will also be cleared.
Returns
Returns true if the render target was successfully changed, false otherwise.
Example
addEventHandler("onClientResourceStart", resourceRoot, function() myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target texture which is 80 x 100 pixels end ) addEventHandler( "onClientRender", root, function() if myRenderTarget then dxSetRenderTarget( myRenderTarget ) -- Select custom render target dxDrawText ( "Hello", 10, 20 ) -- The message 'Hello' will be drawn on myRenderTarget dxSetRenderTarget() -- Select default render target dxDrawText ( "Goodbye", 10, 20 ) -- The message 'Goodbye' will be drawn directly to the screen 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