Commit e2239437569203534d242bccb44d1e7236c48fb8

henry 2004-01-22T08:11:48

Changed FTGLTextureFont to use FTVector for texture id list.

diff --git a/include/FTGLTextureFont.h b/include/FTGLTextureFont.h
index ef95226..f057514 100755
--- a/include/FTGLTextureFont.h
+++ b/include/FTGLTextureFont.h
@@ -2,6 +2,7 @@
 #define     __FTGLTextureFont__
 
 #include "FTFont.h"
+#include "FTVector.h"
 #include "FTGL.h"
 
 class FTTextureGlyph;
@@ -107,14 +108,9 @@ class  FTGL_EXPORT FTGLTextureFont : public FTFont
         /**
          *An array of texture ids
          */
-        GLuint glTextureID[128];
+         FTVector<GLuint> textureIDList;
         
         /**
-         * The number of textures required to hold the glyphs
-         */
-        unsigned int numTextures;
-
-        /**
          * The max height for glyphs in the current font
          */
         int glyphHeight;
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index fe7335e..aa6b645 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -23,7 +23,6 @@ FTGLTextureFont::FTGLTextureFont( const char* fontname)
     maxTextSize(0),
     textureWidth(0),
     textureHeight(0),
-    numTextures(0),
     glyphHeight(0),
     glyphWidth(0),
     padding(3),
@@ -39,7 +38,6 @@ FTGLTextureFont::FTGLTextureFont( const unsigned char *pBufferBytes, size_t buff
     maxTextSize(0),
     textureWidth(0),
     textureHeight(0),
-    numTextures(0),
     glyphHeight(0),
     glyphWidth(0),
     padding(3),
@@ -52,7 +50,7 @@ FTGLTextureFont::FTGLTextureFont( const unsigned char *pBufferBytes, size_t buff
 
 FTGLTextureFont::~FTGLTextureFont()
 {
-    glDeleteTextures( numTextures, (const GLuint*)glTextureID);
+    glDeleteTextures( textureIDList.size(), (const GLuint*)&textureIDList[0]);
 }
 
 
@@ -65,11 +63,10 @@ FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int glyphIndex)
         glyphHeight = static_cast<int>( charSize.Height());
         glyphWidth = static_cast<int>( charSize.Width());
         
-        if( numTextures == 0)
+        if( textureIDList.empty())
         {
-            glTextureID[0] = CreateTexture();
+            textureIDList.push_back( CreateTexture());
             xOffset = yOffset = padding;
-            ++numTextures;
         }
         
         if( xOffset > ( textureWidth - glyphWidth))
@@ -79,13 +76,12 @@ FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int glyphIndex)
             
             if( yOffset > ( textureHeight - glyphHeight))
             {
-                glTextureID[numTextures] = CreateTexture();
-                ++numTextures;
+                textureIDList.push_back( CreateTexture());
                 yOffset = padding;
             }
         }
         
-        FTTextureGlyph* tempGlyph = new FTTextureGlyph( ftGlyph, glTextureID[numTextures - 1],
+        FTTextureGlyph* tempGlyph = new FTTextureGlyph( ftGlyph, textureIDList[textureIDList.size() - 1],
                                                         xOffset, yOffset, textureWidth, textureHeight);
         xOffset += static_cast<int>( tempGlyph->BBox().upperX - tempGlyph->BBox().lowerX + padding);
         
@@ -145,10 +141,9 @@ GLuint FTGLTextureFont::CreateTexture()
 
 bool FTGLTextureFont::FaceSize( const unsigned int size, const unsigned int res)
 {
-    if( numTextures)
+    if( !textureIDList.empty())
     {
-        glDeleteTextures( numTextures, (const GLuint*)glTextureID);
-        numTextures = 0;
+        glDeleteTextures( textureIDList.size(), (const GLuint*)&textureIDList[0]);
         remGlyphs = numGlyphs = face.GlyphCount();
     }