From 2cc3fb471502d7425bb4fc57610a9792e1935a97 Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Tue, 24 Aug 2010 14:12:12 -0500 Subject: [PATCH] Fonts now handle resolution changes properly --- src/modules/graphics/opengl/Font.cpp | 19 +++++++++++++++++++ src/modules/graphics/opengl/Font.h | 6 +++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index b0441a7d8..0b49e7442 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -171,6 +171,25 @@ namespace opengl { return mSpacing; } + + bool Font::loadVolatile() + { + // reload all glyphs + for(unsigned int i = 0; i < MAX_CHARS; i++) + { + glyphs[i]->load(); + glNewList(list + i, GL_COMPILE); + glyphs[i]->draw(0, 0, 0, 1, 1, 0, 0); + glEndList(); + } + return true; + } + + void Font::unloadVolatile() + { + // delete the glyphs + glDeleteLists(list, MAX_CHARS); + } } // opengl } // graphics diff --git a/src/modules/graphics/opengl/Font.h b/src/modules/graphics/opengl/Font.h index 4228b312c..a8b0bb023 100644 --- a/src/modules/graphics/opengl/Font.h +++ b/src/modules/graphics/opengl/Font.h @@ -35,7 +35,7 @@ namespace graphics { namespace opengl { - class Font : public Object + class Font : public Object, public Volatile { private: @@ -148,6 +148,10 @@ namespace opengl * Returns the spacing modifier. **/ float getSpacing() const; + + // Implements Volatile. + bool loadVolatile(); + void unloadVolatile(); }; // Font