ref: 98f66444d764f7f2ff59dfca4a02c0fee9e32855
parent: f55c965a7030847d415e633077f7facd91cf1041
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 14 19:12:18 EDT 2020
Updated OpenGL renderers
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -696,29 +696,14 @@
(void)surface;
}
-unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, size_t *pitch, size_t width, size_t height)
+void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned char *pixels, size_t width, size_t height)
{
- if (surface == NULL)
- return NULL;
-
- surface->pixels = (unsigned char*)malloc(width * height * 3);
- *pitch = width * 3;
- return surface->pixels;
-}
-
-void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, size_t width, size_t height)
-{
- if (surface == NULL)
- return;
-
// Flush the vertex buffer if we're about to modify its texture
if (surface->texture_id == last_source_texture || surface->texture_id == last_destination_texture)
FlushVertexBuffer();
glBindTexture(GL_TEXTURE_2D, surface->texture_id);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, surface->pixels);
- free(surface->pixels);
-
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glBindTexture(GL_TEXTURE_2D, last_source_texture);
}