always deleting WFObj objects after rendering them to reclaim memory

git-svn-id: svn://anubis/anaglym/trunk@189 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-11-18 01:14:55 +00:00
parent 016ae7f1a2
commit 318697cc0d
2 changed files with 7 additions and 1 deletions

View File

@ -169,6 +169,7 @@ bool Engine::load(const char * program)
else else
{ {
m_font = new FTBufferFont(path.c_str()); m_font = new FTBufferFont(path.c_str());
//m_font = new FTTextureFont(path.c_str());
if (m_font->Error() != 0) if (m_font->Error() != 0)
{ {
cerr << "Error loading font '" << path << "'" << endl; cerr << "Error loading font '" << path << "'" << endl;
@ -453,9 +454,9 @@ int Engine::loadModel(const string & name, bool static_data, float scale)
} }
else else
{ {
delete obj;
cerr << "error loading object" << endl; cerr << "error loading object" << endl;
} }
delete obj;
} }
return 0; return 0;
} }
@ -530,6 +531,8 @@ void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
m_font->FaceSize(ptsize); m_font->FaceSize(ptsize);
glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT); glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
// glEnable(GL_BLEND);
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPushMatrix(); glPushMatrix();
glTranslatef(x, y, 0); glTranslatef(x, y, 0);
glColor3f(r, g, b); glColor3f(r, g, b);

View File

@ -26,6 +26,9 @@ function init()
--ball = ag.createSphere(0.4) --ball = ag.createSphere(0.4)
--ball:setColor(0.2, 0.2, 0.9) --ball:setColor(0.2, 0.2, 0.9)
-- local crate = ag.loadModel("crate")
-- crate:setPosition(0, 20, 10)
crate_texture = ag.loadTexture("crate.png") crate_texture = ag.loadTexture("crate.png")
end end