More leak fixes
This was SVN commit r1514.
This commit is contained in:
parent
b534e640ca
commit
465ceff912
@ -65,6 +65,11 @@ CGameView::CGameView(CGame *pGame):
|
||||
InitResources();
|
||||
}
|
||||
|
||||
CGameView::~CGameView()
|
||||
{
|
||||
UnloadResources();
|
||||
}
|
||||
|
||||
void CGameView::Initialize(CGameAttributes *pAttribs)
|
||||
{
|
||||
CConfigValue* cfg;
|
||||
@ -183,6 +188,16 @@ void CGameView::InitResources()
|
||||
g_Renderer.LoadAlphaMaps(fns);
|
||||
}
|
||||
|
||||
void CGameView::UnloadResources()
|
||||
{
|
||||
// Should probably do something like:
|
||||
// g_TexMan.UnloadTerrainTextures();
|
||||
// g_ObjMan.UnloadObjects();
|
||||
|
||||
g_Renderer.UnloadAlphaMaps();
|
||||
}
|
||||
|
||||
|
||||
void CGameView::ResetCamera()
|
||||
{
|
||||
// quick hack to return camera home, for screenshots (after alt+tabbing)
|
||||
|
@ -52,8 +52,13 @@ class CGameView
|
||||
// InitResources(): Load all graphics resources (textures, actor objects and
|
||||
// alpha maps) required by the game
|
||||
void InitResources();
|
||||
|
||||
// UnloadResources(): Unload all graphics resources loaded by InitResources
|
||||
void UnloadResources();
|
||||
|
||||
public:
|
||||
CGameView(CGame *pGame);
|
||||
~CGameView();
|
||||
|
||||
void Initialize(CGameAttributes *pGameAttributes);
|
||||
|
||||
|
@ -1200,6 +1200,9 @@ bool CRenderer::LoadAlphaMaps(const char* fnames[])
|
||||
m_AlphaMapCoords[i].v1=1.0f;
|
||||
}
|
||||
|
||||
for (i=0;i<NumAlphaMaps;i++)
|
||||
tex_free(textures[i]);
|
||||
|
||||
glGenTextures(1,(GLuint*) &m_CompositeAlphaMap);
|
||||
BindTexture(0,m_CompositeAlphaMap);
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_INTENSITY,texsize,base,0,GL_RGB,GL_UNSIGNED_BYTE,data);
|
||||
@ -1213,3 +1216,10 @@ bool CRenderer::LoadAlphaMaps(const char* fnames[])
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UnloadAlphaMaps: frees the resources allocates by LoadAlphaMaps
|
||||
void CRenderer::UnloadAlphaMaps()
|
||||
{
|
||||
glDeleteTextures(1, (GLuint*) &m_CompositeAlphaMap);
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ public:
|
||||
// load the default set of alphamaps; return false if any alphamap fails to load, true otherwise
|
||||
bool LoadAlphaMaps(const char* fnames[]);
|
||||
|
||||
void UnloadAlphaMaps();
|
||||
|
||||
// return stats accumulated for current frame
|
||||
const Stats& GetStats() { return m_Stats; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user