Move OpenGL shape draw mappings

This commit is contained in:
2026-06-01 17:52:59 +02:00
parent aa32c47e18
commit 05064b3a0d
6 changed files with 83 additions and 15 deletions

View File

@@ -2,17 +2,20 @@
#include "log.h"
#include "shape.h"
#include "app.h"
#include "renderer_gl/opengl_capabilities.h"
#include <cstdint>
bool Shape::create_buffers(GLushort * idx, GLvoid * vertices, int isize, int vsize)
{
index_type = GL_UNSIGNED_SHORT;
index_type = static_cast<GLenum>(pp::renderer::gl::index_type_for_index_size(sizeof(GLushort)));
create_buffers_imp(idx, vertices, isize, vsize);
return false;
}
bool Shape::create_buffers(GLuint* idx, GLvoid * vertices, int isize, int vsize)
{
index_type = GL_UNSIGNED_INT;
index_type = static_cast<GLenum>(pp::renderer::gl::index_type_for_index_size(sizeof(GLuint)));
create_buffers_imp(idx, vertices, isize, vsize);
return false;
}
@@ -119,11 +122,7 @@ void Shape::draw_fill() const
{
if (count[0] == 0) return;
GLenum type = GL_TRIANGLES;
if (count[0] == 1)
type = GL_POINTS;
if (count[0] == 2)
type = GL_LINES;
const auto type = static_cast<GLenum>(pp::renderer::gl::primitive_mode_for_fill_count(count[0]));
App::I->render_task([=]
{
#if USE_VBO
@@ -157,9 +156,7 @@ void Shape::draw_stroke() const
{
if (count[0] == 0) return;
GLenum type = GL_LINES;
if (count[1] == 1)
type = GL_POINTS;
const auto type = static_cast<GLenum>(pp::renderer::gl::primitive_mode_for_stroke_count(count[1]));
App::I->render_task([=]
{
#if USE_VBO