DxCreateRenderTarget: 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 creates a render target element, which is a special type of texture that can be...") |
No edit summary |
||
Line 12: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''width :''' The width of the | *'''width :''' The width of the texture in pixels. | ||
*'''height :''' The height of the | *'''height :''' The height of the texture in pixels. | ||
===Returns=== | ===Returns=== | ||
Returns a [[texture | Returns a [[texture]] [[element]] if successful, ''false'' if invalid arguments were passed to the function. | ||
==Example== | ==Example== | ||
Line 22: | Line 22: | ||
addEventHandler("onClientResourceStart", resourceRoot, | addEventHandler("onClientResourceStart", resourceRoot, | ||
function() | function() | ||
myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target which is 80 x 100 pixels | myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target texture which is 80 x 100 pixels | ||
end | end | ||
) | ) |
Revision as of 23:12, 13 June 2011
Only available in 1.1 This function creates a render target element, which is a special type of texture that can be draw on with the dx functions.
Syntax
element dxCreateRenderTarget ( int width, int height )
Required Arguments
- width : The width of the texture in pixels.
- height : The height of the texture in pixels.
Returns
Returns a texture element if successful, false if invalid arguments were passed to the function.
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 ) -- Start drawing on myRenderTarget dxDrawText ( "Hello", 10, 20 ) -- Draw a message dxSetRenderTarget() -- Stop drawing on myRenderTarget dxDrawImage( 50, 50, 100, 100, myRenderTarget ) -- Now use myRenderTarget as a material and draw it lots of times dxDrawImage( 150, 350, 150, 100, myRenderTarget ) dxDrawImage( 250, 250, 100, 150, myRenderTarget ) dxDrawImage( 350, 30, 150, 150, myRenderTarget ) 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