OpenGL: support scene::EHM_STREAM

the relevant enum value is defined in both gl3 and gles2
This commit is contained in:
sfan5 2024-02-18 22:42:36 +01:00
parent 89d0717779
commit 45ace61007

@ -486,10 +486,12 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
{ {
HWBuffer->vbo_verticesSize = bufferSize; HWBuffer->vbo_verticesSize = bufferSize;
if (HWBuffer->Mapped_Vertex == scene::EHM_STATIC) GLenum usage = GL_STATIC_DRAW;
GL.BufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); if (HWBuffer->Mapped_Index == scene::EHM_STREAM)
else usage = GL_STREAM_DRAW;
GL.BufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_DYNAMIC_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); GL.BindBuffer(GL_ARRAY_BUFFER, 0);
@ -549,10 +551,12 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
{ {
HWBuffer->vbo_indicesSize = indexCount * indexSize; HWBuffer->vbo_indicesSize = indexCount * indexSize;
if (HWBuffer->Mapped_Index == scene::EHM_STATIC) GLenum usage = GL_STATIC_DRAW;
GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW); if (HWBuffer->Mapped_Index == scene::EHM_STREAM)
else usage = GL_STREAM_DRAW;
GL.BufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_DYNAMIC_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); GL.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);