diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-09-17 15:30:21 +0200 | 
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-09-17 15:30:21 +0200 | 
| commit | f28e9c3e03a9f94764b3811f7c4aa01991943fc7 (patch) | |
| tree | 569850adf97494f5ce31dfe31a4c2703f378a144 /src/renderer/opengl/GlVertexBuffer.cpp | |
| parent | b46a0d9369fbaa1938f0968ab216bc2d564a9c37 (diff) | |
switch to software renderer
Diffstat (limited to 'src/renderer/opengl/GlVertexBuffer.cpp')
| -rw-r--r-- | src/renderer/opengl/GlVertexBuffer.cpp | 54 | 
1 files changed, 0 insertions, 54 deletions
diff --git a/src/renderer/opengl/GlVertexBuffer.cpp b/src/renderer/opengl/GlVertexBuffer.cpp deleted file mode 100644 index f716c50..0000000 --- a/src/renderer/opengl/GlVertexBuffer.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include <renderer/opengl/GlVertexBuffer.hpp> - -#include <GL/glew.h> -#include <string.h> - -#include <stdio.h> - -void GlVertexBuffer::Init() { -    m_Vertices.reserve(16384); -    glGenBuffers(1, &m_Id); -    glBindBuffer(GL_ARRAY_BUFFER, m_Id); -} - -void GlVertexBuffer::Reset() { -    glDisableVertexAttribArray(0); -    glDisableVertexAttribArray(1); -    m_Vertices.clear(); -} - -float *GlVertexBuffer::GetData() { -    return reinterpret_cast<float*>(m_Vertices.data()); -} - -uint32_t GlVertexBuffer::GetCount() { -    return static_cast<uint32_t>(m_Vertices.size()); -} - -void GlVertexBuffer::PushRectangle(V3F32 pos, V2F32 dim, V3F32 color) { -    V3F32 positions[4] = { -        V3F32(pos.x,         pos.y,         pos.z), -        V3F32(pos.x + dim.x, pos.y,         pos.z), -        V3F32(pos.x + dim.x, pos.y + dim.y, pos.z), -        V3F32(pos.x,         pos.y + dim.y, pos.z), -    }; - -    for (int i = 0; i < 4; i++) { -        GlVertex vertex = {}; -        vertex.pos = positions[i]; -        vertex.color = color; -        m_Vertices.push_back(vertex); -    } -} - -void GlVertexBuffer::TransferData() { -    size_t size = m_Vertices.size() * sizeof(GlVertex); -    GLsizei stride = sizeof(GlVertex); -    const void *offset_color = (const void*)(3*sizeof(float)); -    glEnableVertexAttribArray(0); -    glEnableVertexAttribArray(1); -    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, 0); -    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, offset_color); -    glBufferData(GL_ARRAY_BUFFER, size, m_Vertices.data(), GL_STATIC_DRAW); -} -  | 
