aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-05-19 23:06:42 +0200
committerArisotura <thetotalworm@gmail.com>2019-05-19 23:06:42 +0200
commit1fb396804756eba6f87ea2112c73868d6d651ea8 (patch)
treec2b9da7aaa0de7bf45d9af869b8e62fda6566b66 /src
parent6dbb645ffa84666a83cc3d77cd5cd9ca298bc7f7 (diff)
properly clean up GL resources
Diffstat (limited to 'src')
-rw-r--r--src/GPU3D_OpenGL43.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/GPU3D_OpenGL43.cpp b/src/GPU3D_OpenGL43.cpp
index 66e9d53..af94432 100644
--- a/src/GPU3D_OpenGL43.cpp
+++ b/src/GPU3D_OpenGL43.cpp
@@ -104,16 +104,8 @@ int FrontBuffer;
GLuint FramebufferID[4], PixelbufferID;
u32* Framebuffer = NULL;
-bool ChunkedRendering = false;
-bool InitGLExtensions()
-{
- // TODO move this elsewhere!!
- //if (!OpenGL_Init()) return false;
- return true;
-}
-
bool BuildRenderShader(u32 flags, const char* vs, const char* fs)
{
char shadername[32];
@@ -159,8 +151,6 @@ void SetupDefaultTexParams(GLuint tex)
bool Init()
{
- if (!InitGLExtensions()) return false;
-
const GLubyte* renderer = glGetString(GL_RENDERER); // get renderer string
const GLubyte* version = glGetString(GL_VERSION); // version as a string
printf("OpenGL: renderer: %s\n", renderer);
@@ -341,7 +331,24 @@ bool Init()
void DeInit()
{
- // TODO CLEAN UP SHIT!!!!
+ glDeleteTextures(1, &TexMemID);
+ glDeleteTextures(1, &TexPalMemID);
+
+ glDeleteFramebuffers(4, &FramebufferID[0]);
+ glDeleteTextures(8, &FramebufferTex[0]);
+
+ glDeleteVertexArrays(1, &VertexArrayID);
+ glDeleteBuffers(1, &VertexBufferID);
+ glDeleteVertexArrays(1, &ClearVertexArrayID);
+ glDeleteBuffers(1, &ClearVertexBufferID);
+
+ glDeleteBuffers(1, &ShaderConfigUBO);
+
+ for (int i = 0; i < 16; i++)
+ {
+ if (!RenderShader[i][2]) continue;
+ OpenGL_DeleteShaderProgram(RenderShader[i]);
+ }
}
void Reset()
@@ -696,6 +703,8 @@ void RenderSceneChunk(int y, int h)
_endptr = rp->Indices;
break;
}
+
+ // berg.
}
u32 num = (u32)(_endptr - iptr);
if (num) glDrawElements(GL_TRIANGLES, num, GL_UNSIGNED_SHORT, iptr);