Skip to content
Working with DirectX

Working with DirectX

Working with DirectX

DirectX 11 functions and shaders are designed for 3D visualization directly on a price chart.

Creating 3D graphics requires a graphic context (DXContextCreate) with the necessary image size. Besides, it is necessary to prepare vertex and index buffers (DXBufferCreate), as well as create vertex and pixel shaders (DXShaderCreate). This is enough to display graphics in color.

The next level of graphics requires the inputs (DXInputSet) for passing additional rendering parameters to shaders. This allows setting the camera and 3D object positions, describe light sources and implement mouse and keyboard control.

Thus, the built-in MQL5 functions enable you to create animated 3D charts directly in MetaTrader 5 with no need for third-party tools. A video card should support DX 11 and Shader Model 5.0 for the functions to work.

To start working with the library, simply read the article How to create 3D graphics using DirectX in MetaTrader 5.

FunctionAction
DXContextCreateCreates a graphic context for rendering frames of a specified size
DXContextSetSizeChanges a frame size of a graphic context created in DXContextCreate()
DXContextSetSizeGets a frame size of a graphic context created in DXContextCreate()
DXContextClearColorsSets a specified color to all pixels for the rendering buffer
DXContextClearDepthClears the depth buffer
DXContextGetColorsGets an image of a specified size and offset from a graphic context
DXContextGetDepthGets the depth buffer of a rendered frame
DXBufferCreateCreates a buffer of a specified type based on a data array
DXTextureCreateCreates a 2D texture out of a rectangle of a specified size cut from a passed image
DXInputCreateCreates shader inputs
DXInputSetSets shader inputs
DXShaderCreateCreates a shader of a specified type
DXShaderSetLayoutSets vertex layout for the vertex shader
DXShaderInputsSetSets shader inputs
DXShaderTexturesSetSets shader textures
DXDrawRenders the vertices of the vertex buffer set in DXBufferSet()
DXDrawIndexedRenders graphic primitives described by the index buffer from DXBufferSet()
DXPrimiveTopologySetSets the type of primitives for rendering using DXDrawIndexed()
DXBufferSetSets a buffer for the current rendering
DXShaderSetSets a shader for rendering
DXHandleTypeReturns a handle type
DXReleaseReleases a handle
Last updated on