110 void setAttribLayout(std::span<const GLVertexAttrib> attribs,
size_t stride);
115 void setData(
const void *data,
size_t sizeInBytes);
120 void setVertexCount(
int count);
123 template<std::ranges::contiguous_range T>
124 requires std::is_same<std::ranges::range_value_t<T>,
GLVertex2D>::value
127 setData(range.data(), range.size() *
sizeof(
GLVertex2D));
128 setVertexCount(range.size());
129 setAttribLayout(std::span(GLVertex2DLayout),
sizeof(
GLVertex2D));
132 template<std::ranges::contiguous_range T>
133 requires std::is_same<std::ranges::range_value_t<T>,
GLVertex3D>::value
136 setData(range.data(), range.size() *
sizeof(
GLVertex3D));
137 setVertexCount(range.size());
138 setAttribLayout(std::span(GLVertex3DLayout),
sizeof(
GLVertex3D));
141 template<std::ranges::contiguous_range T>
142 requires std::is_same<std::ranges::range_value_t<T>, QVector2D>::value
145 setData(range.data(), range.size() *
sizeof(QVector2D));
146 setVertexCount(range.size());
153 setAttribLayout(std::span(&layout, 1),
sizeof(QVector2D));
176 std::optional<std::span<T>>
map(
size_t count)
178 if (
const auto m = map(
sizeof(T) * count)) {
179 return std::span(
reinterpret_cast<T *
>(m), count);
203 void draw(GLenum primitiveMode,
int first,
int count);
208 void draw(
const QRegion ®ion, GLenum primitiveMode,
int first,
int count,
bool hardwareClipping =
false);
216 void render(GLenum primitiveMode);
221 void render(
const QRegion ®ion, GLenum primitiveMode,
bool hardwareClipping =
false);
247 static void initStatic();
252 static void cleanup();
257 static bool supportsIndexedQuads();
265 static constexpr std::array GLVertex2DLayout{
270 .relativeOffset = offsetof(
GLVertex2D, position),
276 .relativeOffset = offsetof(
GLVertex2D, texcoord),
279 static constexpr std::array GLVertex3DLayout{
284 .relativeOffset = offsetof(
GLVertex3D, position),
290 .relativeOffset = offsetof(
GLVertex3D, texcoord),
295 GLvoid *map(
size_t size);
297 const std::unique_ptr<GLVertexBufferPrivate> d;