From 45ace610077d7ccfd6abf9062749e25a9277b75a Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 18 Feb 2024 22:42:36 +0100 Subject: [PATCH] OpenGL: support scene::EHM_STREAM the relevant enum value is defined in both gl3 and gles2 --- source/Irrlicht/OpenGL/Driver.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/Irrlicht/OpenGL/Driver.cpp b/source/Irrlicht/OpenGL/Driver.cpp index 7a94792f..37803e4f 100644 --- a/source/Irrlicht/OpenGL/Driver.cpp +++ b/source/Irrlicht/OpenGL/Driver.cpp @@ -486,10 +486,12 @@ COpenGL3DriverBase::~COpenGL3DriverBase() { HWBuffer->vbo_verticesSize = bufferSize; - if (HWBuffer->Mapped_Vertex == scene::EHM_STATIC) - GL.BufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); - else - GL.BufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_DYNAMIC_DRAW); + GLenum usage = GL_STATIC_DRAW; + if (HWBuffer->Mapped_Index == scene::EHM_STREAM) + usage = GL_STREAM_DRAW; + else if (HWBuffer->Mapped_Index == scene::EHM_DYNAMIC) + usage = GL_DYNAMIC_DRAW; + GL.BufferData(GL_ARRAY_BUFFER, bufferSize, buffer, usage); } GL.BindBuffer(GL_ARRAY_BUFFER, 0); @@ -549,10 +551,12 @@ COpenGL3DriverBase::~COpenGL3DriverBase() { HWBuffer->vbo_indicesSize = indexCount * indexSize; - if (HWBuffer->Mapped_Index == scene::EHM_STATIC) - GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW); - else - GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_DYNAMIC_DRAW); + GLenum usage = GL_STATIC_DRAW; + if (HWBuffer->Mapped_Index == scene::EHM_STREAM) + usage = GL_STREAM_DRAW; + else if (HWBuffer->Mapped_Index == scene::EHM_DYNAMIC) + usage = GL_DYNAMIC_DRAW; + GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, usage); } GL.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);