dxDrawPrimitive
Client-side
Server-side
Shared
Needs checking
This function was partially migrated from the old wiki. Please review manually:
- Missing section: Allowed types
- Missing section: Vertices format
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function draws a 2D primitive shape across the screen - rendered for one frame. This should be used in conjunction with onClientRender in order to display continuously.
Syntax
bool dxDrawPrimitive ( string pType, bool postGUI, table vertex1, table vertex2, unknown ... )Required Arguments
- pType: Type of primitive to be drawn.
- postGUI: A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).
- vertex1: MISSING_PARAM_DESC
- vertex2: MISSING_PARAM_DESC
- ...: MISSING_PARAM_DESC
Returns
- bool: value
Returns a true if the operation was successful, false otherwise.
Code Examples
shared
This is a small example that creates trianglefan primitive with vertices in places that user clicks. It assigns every vertex random color.
local vertices = {}function onClick(btn, state, x, y) if btn ~= "left" then return end if state ~= "up" then return end local vertex = {x, y, tocolor(math.random(255), math.random(255), math.random(255))} table.insert(vertices, vertex)endaddEventHandler("onClientClick", root, onClick)
function draw() dxDrawPrimitive("trianglefan", true, unpack(vertices))endaddEventHandler("onClientPreRender", root, draw)See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatus
- dxGetTextSize
- dxGetTexturePixels
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource