View on GitHub


class VertexArray:;
Define a set of one or more 2D primitives.

VertexArray is a very simple wrapper around a dynamic array of vertices and a primitives type.

It inherits Drawable, but unlike other drawables it is not transformable.

Laurent Gomila, Jeremy DeHaan

See Also:


PrimitiveType primitiveType;
The type of primitive to draw.

Can be any of the following: - Points - Lines - Triangles - Quads

The default primitive type is Points.

FloatRect getBounds();
Compute the bounding rectangle of the vertex array.

This function returns the axis-aligned rectangle that contains all the vertices of the array.

Bounding rectangle of the vertex array.

uint getVertexCount();
Return the vertex count.

Number of vertices in the array

void append(Vertex newVertex);
Add a vertex to the array.

vertex Vertex to add.

void clear();
Clear the vertex array.

This function removes all the vertices from the array. It doesn't deallocate the corresponding memory, so that adding new vertices after clearing doesn't involve reallocating all the memory.

void draw(RenderTarget renderTarget, RenderStates renderStates);
Draw the object to a render target.

RenderTarget renderTarget Render target to draw to
RenderStates renderStates Current render states

void resize(uint length);
Resize the vertex array.

If vertexCount is greater than the current size, the previous vertices are kept and new (default-constructed) vertices are added. If vertexCount is less than the current size, existing vertices are removed from the array.

vertexCount New size of the array (number of vertices).