1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

LibAccelGfx: Create VBO to pass vertices data to GPU

Before, we were using a feature of OpenGL that allows specifying a
pointer to allocated vertex data without creating VBO and VAO, but as
I found out, it does not work on macOS.
This commit is contained in:
Aliaksandr Kalenik 2023-11-11 14:07:10 +01:00 committed by Andreas Kling
parent 20734ac335
commit 2d12d1538d
3 changed files with 110 additions and 7 deletions

View file

@ -37,6 +37,14 @@ struct Texture {
GLuint id;
};
struct Buffer {
GLuint id;
};
struct VertexArray {
GLuint id;
};
void set_viewport(Gfx::IntRect);
void enable_blending();
@ -55,7 +63,7 @@ void upload_texture_data(Texture const& texture, Gfx::Bitmap const& bitmap);
void delete_texture(Texture const&);
void set_uniform(Uniform const& uniform, float, float, float, float);
void set_vertex_attribute(VertexAttribute const& attribute, Span<float> values, int number_of_components);
void set_vertex_attribute(VertexAttribute const& attribute, u32 offset, int number_of_components);
enum class ScalingMode {
Nearest,
@ -72,4 +80,13 @@ enum class DrawPrimitive {
void draw_arrays(DrawPrimitive, size_t count);
Buffer create_buffer();
void bind_buffer(Buffer const&);
void upload_to_buffer(Buffer const&, Span<float> values);
void delete_buffer(Buffer const&);
VertexArray create_vertex_array();
void bind_vertex_array(VertexArray const&);
void delete_vertex_array(VertexArray const&);
}