140 [[nodiscard]]
bool create(std::size_t vertexCount);
201 [[nodiscard]]
bool update(
const Vertex* vertices, std::size_t vertexCount,
unsigned int offset);
337 unsigned int m_buffer{};
338 std::size_t m_size{};
339 PrimitiveType m_primitiveType{PrimitiveType::Points};
340 Usage m_usage{Usage::Stream};
#define SFML_GRAPHICS_API
Abstract base class for objects that can be drawn to a render target.
friend class RenderTarget
GlResource()
Default constructor.
Base class for all render targets (window, texture, ...)
Vertex buffer storage for one or more 2D primitives.
PrimitiveType getPrimitiveType() const
Get the type of primitives drawn by the vertex buffer.
static void bind(const VertexBuffer *vertexBuffer)
Bind a vertex buffer for rendering.
~VertexBuffer() override
Destructor.
VertexBuffer(const VertexBuffer ©)
Copy constructor.
VertexBuffer(PrimitiveType type, Usage usage)
Construct a VertexBuffer with a specific PrimitiveType and usage specifier.
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the vertex buffer.
@ Static
Rarely changing data.
@ Dynamic
Occasionally changing data.
@ Stream
Constantly changing data.
VertexBuffer(PrimitiveType type)
Construct a VertexBuffer with a specific PrimitiveType
bool update(const VertexBuffer &vertexBuffer)
Copy the contents of another buffer into this buffer.
Usage getUsage() const
Get the usage specifier of this vertex buffer.
static bool isAvailable()
Tell whether or not the system supports vertex buffers.
std::size_t getVertexCount() const
Return the vertex count.
void setPrimitiveType(PrimitiveType type)
Set the type of primitives to draw.
VertexBuffer()=default
Default constructor.
bool create(std::size_t vertexCount)
Create the vertex buffer.
void setUsage(Usage usage)
Set the usage specifier of this vertex buffer.
bool update(const Vertex *vertices)
Update the whole buffer from an array of vertices.
bool update(const Vertex *vertices, std::size_t vertexCount, unsigned int offset)
Update a part of the buffer from an array of vertices.
VertexBuffer & operator=(const VertexBuffer &right)
Overload of assignment operator.
VertexBuffer(Usage usage)
Construct a VertexBuffer with a specific usage specifier.
void swap(VertexBuffer &right) noexcept
Swap the contents of this vertex buffer with those of another.
PrimitiveType
Types of primitives that a sf::VertexArray can render.
void swap(Texture &left, Texture &right) noexcept
Swap the contents of one texture with those of another.
Define the states used for drawing to a RenderTarget
Point with color and texture coordinates.