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:
parent
318697cc0d
commit
459b3704d6
16
Engine.cc
16
Engine.cc
@ -75,9 +75,6 @@ static void debug_hook(lua_State * L, lua_Debug * debug)
|
|||||||
#define DEBUG_GL_ERROR
|
#define DEBUG_GL_ERROR
|
||||||
#ifdef DEBUG_GL_ERROR
|
#ifdef DEBUG_GL_ERROR
|
||||||
#define checkGLError() checkGLErrorLine(__FUNCTION__, __LINE__)
|
#define checkGLError() checkGLErrorLine(__FUNCTION__, __LINE__)
|
||||||
#else
|
|
||||||
#define checkGLError()
|
|
||||||
#endif
|
|
||||||
static void checkGLErrorLine(const char * function, int line)
|
static void checkGLErrorLine(const char * function, int line)
|
||||||
{
|
{
|
||||||
GLenum err = glGetError();
|
GLenum err = glGetError();
|
||||||
@ -88,6 +85,9 @@ static void checkGLErrorLine(const char * function, int line)
|
|||||||
<< dec << line << endl;
|
<< dec << line << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define checkGLError()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/******** Engine functions ********/
|
/******** Engine functions ********/
|
||||||
@ -454,7 +454,7 @@ int Engine::loadModel(const string & name, bool static_data, float scale)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "error loading object" << endl;
|
cerr << "error loading object '" << name << "'" << endl;
|
||||||
}
|
}
|
||||||
delete obj;
|
delete obj;
|
||||||
}
|
}
|
||||||
@ -529,10 +529,10 @@ void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
|||||||
{
|
{
|
||||||
checkGLError();
|
checkGLError();
|
||||||
m_font->FaceSize(ptsize);
|
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);
|
glDisable(GL_LIGHTING);
|
||||||
// glEnable(GL_BLEND);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, 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);
|
||||||
@ -1366,7 +1366,9 @@ FileLoader::Buffer Engine::EngineFileLoader::load(const Path & path)
|
|||||||
int num_read = fread(buf.data, size, 1, fp);
|
int num_read = fread(buf.data, size, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (num_read > 0)
|
if (num_read > 0)
|
||||||
|
{
|
||||||
return buf;
|
return buf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Buffer(0);
|
return Buffer(0);
|
||||||
|
2
Video.cc
2
Video.cc
@ -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);
|
gluPerspective(60.0, (double) width / (double) height, 0.01, 10000.0);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user