fixed bug in drawing text (working around FTGL deficiency) by setting texture environment mode to GL_BLEND when drawing text

git-svn-id: svn://anubis/anaglym/trunk@190 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-11-20 04:52:17 +00:00
parent 318697cc0d
commit 459b3704d6
2 changed files with 11 additions and 7 deletions

View File

@ -75,9 +75,6 @@ static void debug_hook(lua_State * L, lua_Debug * debug)
#define DEBUG_GL_ERROR
#ifdef DEBUG_GL_ERROR
#define checkGLError() checkGLErrorLine(__FUNCTION__, __LINE__)
#else
#define checkGLError()
#endif
static void checkGLErrorLine(const char * function, int line)
{
GLenum err = glGetError();
@ -88,6 +85,9 @@ static void checkGLErrorLine(const char * function, int line)
<< dec << line << endl;
}
}
#else
#define checkGLError()
#endif
/******** Engine functions ********/
@ -454,7 +454,7 @@ int Engine::loadModel(const string & name, bool static_data, float scale)
}
else
{
cerr << "error loading object" << endl;
cerr << "error loading object '" << name << "'" << endl;
}
delete obj;
}
@ -529,10 +529,10 @@ void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
{
checkGLError();
m_font->FaceSize(ptsize);
glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
// glEnable(GL_BLEND);
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
glPushMatrix();
glTranslatef(x, y, 0);
glColor3f(r, g, b);
@ -1366,7 +1366,9 @@ FileLoader::Buffer Engine::EngineFileLoader::load(const Path & path)
int num_read = fread(buf.data, size, 1, fp);
fclose(fp);
if (num_read > 0)
{
return buf;
}
}
}
return Buffer(0);

View File

@ -72,6 +72,8 @@ void Video::start(int width, int height, bool fullscreen, bool grab_input,
gluPerspective(60.0, (double) width / (double) height, 0.01, 10000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
}
}