1
0

Fix to delete graphic page

This commit is contained in:
otya128
2016-12-12 20:00:33 +09:00
parent b5d6fb429b
commit a54c0d7e7d
2 changed files with 19 additions and 0 deletions

View File

@@ -90,6 +90,10 @@ class Graphic
} }
void initGraphicPages() void initGraphicPages()
{ {
if (GRP.length != 0 && GRP[0].glTexture/*TODO:gl texture 0?*/)
{
oldGRP = GRP;
}
GRP = new GraphicPage[6]; GRP = new GraphicPage[6];
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
{ {
@@ -204,6 +208,7 @@ class Graphic
} }
uint gcolor = -1; uint gcolor = -1;
GraphicPage[] GRP; GraphicPage[] GRP;
GraphicPage[] oldGRP;
class Paint class Paint
{ {
uint[] buffer; uint[] buffer;
@@ -424,6 +429,13 @@ class Graphic
{ {
if (!GRP[0].glTexture) if (!GRP[0].glTexture)
{ {
if (oldGRP.length)
{
foreach (i; oldGRP)
{
i.deleteGL;
}
}
initGLGraphicPages(); initGLGraphicPages();
} }
if(!drawMessageLength) return; if(!drawMessageLength) return;

View File

@@ -132,6 +132,13 @@ class GraphicPage
} }
glBindFramebufferEXT(GL_FRAMEBUFFER, old); glBindFramebufferEXT(GL_FRAMEBUFFER, old);
} }
void deleteGL()
{
glDeleteFramebuffersEXT(1, &buffer);
glDeleteRenderbuffersEXT(1, &render);
glDeleteTextures(1, &glTexture);
buffer = render = glTexture = 0;
}
} }
version(Windows) version(Windows)