CSFML 3.0.0
Loading...
Searching...
No Matches
VertexBuffer.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Graphics/Export.h>
31
32#include <CSFML/Graphics/PrimitiveType.h>
33#include <CSFML/Graphics/Types.h>
34#include <CSFML/Graphics/Vertex.h>
35
36#include <stddef.h>
37
38
50 typedef enum
51{
52 sfVertexBufferStream,
53 sfVertexBufferDynamic,
54 sfVertexBufferStatic
55} sfVertexBufferUsage;
56
72 CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(size_t vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
73
82 CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer);
83
90 CSFML_GRAPHICS_API void sfVertexBuffer_destroy(const sfVertexBuffer* vertexBuffer);
91
100 CSFML_GRAPHICS_API size_t sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer);
101
134 CSFML_GRAPHICS_API bool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer,
135 const sfVertex* vertices,
136 unsigned int vertexCount,
137 unsigned int offset);
138
148 CSFML_GRAPHICS_API bool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other);
149
157 CSFML_GRAPHICS_API void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right);
158
169 CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(const sfVertexBuffer* vertexBuffer);
170
183 CSFML_GRAPHICS_API void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type);
184
193 CSFML_GRAPHICS_API sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer);
194
211 CSFML_GRAPHICS_API void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage);
212
221 CSFML_GRAPHICS_API sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer);
222
244 CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
245
256 CSFML_GRAPHICS_API bool sfVertexBuffer_isAvailable(void);
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:42
Types.h
sfVertexBuffer
struct sfVertexBuffer sfVertexBuffer
Definition Graphics/Types.h:42
PrimitiveType.h
sfPrimitiveType
sfPrimitiveType
Types of primitives that an sfVertexArray can render.
Definition PrimitiveType.h:42
sfVertexBuffer_updateFromVertexBuffer
bool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer *vertexBuffer, const sfVertexBuffer *other)
Copy the contents of another buffer into this buffer.
sfVertexBuffer_update
bool sfVertexBuffer_update(sfVertexBuffer *vertexBuffer, const sfVertex *vertices, unsigned int vertexCount, unsigned int offset)
Update a part of the buffer from an array of vertices.
sfVertexBuffer_isAvailable
bool sfVertexBuffer_isAvailable(void)
Tell whether or not the system supports vertex buffers.
sfVertexBufferUsage
sfVertexBufferUsage
Usage specifiers.
Definition VertexBuffer.h:51
sfVertexBufferStatic
@ sfVertexBufferStatic
Rarely changing data.
Definition VertexBuffer.h:54
sfVertexBufferStream
@ sfVertexBufferStream
Constantly changing data.
Definition VertexBuffer.h:52
sfVertexBufferDynamic
@ sfVertexBufferDynamic
Occasionally changing data.
Definition VertexBuffer.h:53
sfVertexBuffer_getVertexCount
size_t sfVertexBuffer_getVertexCount(const sfVertexBuffer *vertexBuffer)
Return the vertex count.
sfVertexBuffer_swap
void sfVertexBuffer_swap(sfVertexBuffer *left, sfVertexBuffer *right)
Swap the contents of this vertex buffer with those of another.
sfVertexBuffer_getNativeHandle
unsigned int sfVertexBuffer_getNativeHandle(const sfVertexBuffer *vertexBuffer)
Get the underlying OpenGL handle of the vertex buffer.
sfVertexBuffer_destroy
void sfVertexBuffer_destroy(const sfVertexBuffer *vertexBuffer)
Destroy an existing vertex buffer.
sfVertexBuffer_getUsage
sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer *vertexBuffer)
Get the usage specifier of this vertex buffer.
sfVertexBuffer_bind
void sfVertexBuffer_bind(const sfVertexBuffer *vertexBuffer)
Bind a vertex buffer for rendering.
sfVertexBuffer_copy
sfVertexBuffer * sfVertexBuffer_copy(const sfVertexBuffer *vertexBuffer)
Copy an existing vertex buffer.
sfVertexBuffer_setPrimitiveType
void sfVertexBuffer_setPrimitiveType(sfVertexBuffer *vertexBuffer, sfPrimitiveType type)
Set the type of primitives to draw.
sfVertexBuffer_setUsage
void sfVertexBuffer_setUsage(sfVertexBuffer *vertexBuffer, sfVertexBufferUsage usage)
Set the usage specifier of this vertex buffer.
sfVertexBuffer_getPrimitiveType
sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer *vertexBuffer)
Get the type of primitives drawn by the vertex buffer.
sfVertexBuffer_create
sfVertexBuffer * sfVertexBuffer_create(size_t vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage)
Create a new vertex buffer with a specific sfPrimitiveType and usage specifier.
Vertex.h
sfVertex
Define a point with color and texture coordinates.
Definition Vertex.h:40