delete OpenGL resources in the destructor

Change-Id: Ibfeb836d23d48e4ad9fd9b111394b8349ba7c8a3
This commit is contained in:
Markus Mohrhard
2014-05-09 04:10:19 +02:00
parent 248a8d6c76
commit 7c1bf9e53b
2 changed files with 22 additions and 1 deletions

View File

@@ -168,6 +168,7 @@ class OpenGL3DRenderer
{
public:
OpenGL3DRenderer();
~OpenGL3DRenderer();
void CreateFrameBufferObj();
void CreateTextureObj(int,int);

View File

@@ -80,7 +80,6 @@ OpenGL3DRenderer::OpenGL3DRenderer():
m_Polygon3DInfo.normals = NULL;
m_Polygon3DInfo.lineWidth = 0.001f;
m_Extrude3DInfo.lineOnly = false;
m_Extrude3DInfo.twoSidesLighting = false;
m_Extrude3DInfo.lineWidth = 0.001f;
@@ -101,6 +100,27 @@ OpenGL3DRenderer::OpenGL3DRenderer():
m_RoundBarMesh.iMeshSizes = 0;
}
OpenGL3DRenderer::~OpenGL3DRenderer()
{
// delete programs
glDeleteProgram(m_CommonProID);
glDeleteProgram(m_RenderProID);
glDeleteProgram(m_TextProID);
glDeleteProgram(m_3DProID);
// delete buffers
glDeleteBuffers(1, &m_CubeVertexBuf);
glDeleteBuffers(1, &m_CubeNormalBuf);
glDeleteBuffers(1, &m_CubeElementBuf);
glDeleteBuffers(1, &m_BoundBox);
glDeleteBuffers(1, &m_BoundBoxNormal);
glDeleteBuffers(1, &m_CoordinateBuf);
glDeleteBuffers(1, &m_TextTexCoordBuf);
glDeleteBuffers(1, &m_RenderTexCoordBuf);
glDeleteBuffers(1, &m_RenderVertexBuf);
glDeleteBuffers(1, &m_3DUBOBuffer);
}
void OpenGL3DRenderer::LoadShaders()
{
m_3DProID = OpenGLHelper::LoadShaders("shape3DVertexShader", "shape3DFragmentShader");