Draw vertices

    When loading a scene, Xenko automatically handles the draw calls to display the scene throughout the entity system. This page introduces manual drawing.

    Xenko provides the following set of built-in primitives:

    • Cube
    • Sphere
    • Cylinder
    • Torus

    Code: Creating and using a primitive

    Custom drawing

    Outside of built-in primitives, any geometry can be drawn by creating custom vertex buffers. To create a vertex buffer, first a has to be defined. A vertex declaration describes the elements of each vertex and their layout.For details, see the VertexElement reference page.

    Next, a vertex buffer can be created from an array of vertices. The vertex data type has to match the .

    Given vertex buffer and declaration, a VertexBufferBinding can be created.

    To draw the newly created vertex buffer, it has to be bound to the pipeline. The vertex layout and the to draw have to be included in the pipeline state object. The buffer itself can be set dynamically.

    Afterwards, the vertices are ready to be rendered using .

    Code: Binding and drawing vertex buffers

    Code: Drawing indexed vertices