Commit 8bdfef744e0286e83a0bcd53f19d2b2361215db2

henry 2004-10-03T22:50:30

Adding support for turning off display lists in FTGL

diff --git a/src/FTGLExtrdFont.cpp b/src/FTGLExtrdFont.cpp
index 37d8933..347eea5 100644
--- a/src/FTGLExtrdFont.cpp
+++ b/src/FTGLExtrdFont.cpp
@@ -24,7 +24,7 @@ FTGlyph* FTGLExtrdFont::MakeGlyph( unsigned int glyphIndex)
 
     if( ftGlyph)
     {
-        FTExtrdGlyph* tempGlyph = new FTExtrdGlyph( ftGlyph, depth);
+        FTExtrdGlyph* tempGlyph = new FTExtrdGlyph( ftGlyph, depth, useDisplayLists);
         return tempGlyph;
     }
 
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index b9fd187..cca63bd 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -22,7 +22,7 @@ FTGlyph* FTGLOutlineFont::MakeGlyph( unsigned int g)
 
     if( ftGlyph)
     {
-        FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( ftGlyph);
+        FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( ftGlyph, useDisplayLists);
         return tempGlyph;
     }
 
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index 2d4dfa1..47a1de1 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -22,7 +22,7 @@ FTGlyph* FTGLPolygonFont::MakeGlyph( unsigned int g)
 
     if( ftGlyph)
     {
-        FTPolyGlyph* tempGlyph = new FTPolyGlyph( ftGlyph);
+        FTPolyGlyph* tempGlyph = new FTPolyGlyph( ftGlyph, useDisplayLists);
         return tempGlyph;
     }
 
diff --git a/src/FTGlyph.cpp b/src/FTGlyph.cpp
index c686329..8f3373b 100755
--- a/src/FTGlyph.cpp
+++ b/src/FTGlyph.cpp
@@ -1,8 +1,9 @@
 #include    "FTGlyph.h"
 
 
-FTGlyph::FTGlyph( FT_GlyphSlot glyph)
+FTGlyph::FTGlyph( FT_GlyphSlot glyph, bool useList)
 :   advance(0.0f),
+    useDisplayList(useList),
     err(0)  
 {
     if( glyph)
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index 708bb39..6105ffa 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -69,7 +69,6 @@ FTPixmapGlyph::FTPixmapGlyph( FT_GlyphSlot glyph)
                 dest -= destStep;
             }
         }
-
         destHeight = srcHeight;
     }
 
diff --git a/test/FTExtrdGlyph-Test.cpp b/test/FTExtrdGlyph-Test.cpp
index 7a1a9cf..7a2120f 100644
--- a/test/FTExtrdGlyph-Test.cpp
+++ b/test/FTExtrdGlyph-Test.cpp
@@ -33,7 +33,7 @@ class FTExtrdGlyphTest : public CppUnit::TestCase
             
             buildGLContext();
         
-            FTExtrdGlyph* extrudedGlyph = new FTExtrdGlyph( face->glyph, 0.0f);            
+            FTExtrdGlyph* extrudedGlyph = new FTExtrdGlyph( face->glyph, 0.0f, true);
             CPPUNIT_ASSERT( extrudedGlyph->Error() == 0);
         
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
@@ -47,7 +47,7 @@ class FTExtrdGlyphTest : public CppUnit::TestCase
             
             buildGLContext();
         
-            FTExtrdGlyph* extrudedGlyph = new FTExtrdGlyph( face->glyph, 0.0f);            
+            FTExtrdGlyph* extrudedGlyph = new FTExtrdGlyph( face->glyph, 0.0f, true);
             CPPUNIT_ASSERT( extrudedGlyph->Error() == 0);
             extrudedGlyph->Render(FTPoint(0, 0, 0));
 
diff --git a/test/FTGLBitmapFont-Test.cpp b/test/FTGLBitmapFont-Test.cpp
index a74cd70..b5345f2 100644
--- a/test/FTGLBitmapFont-Test.cpp
+++ b/test/FTGLBitmapFont-Test.cpp
@@ -14,6 +14,7 @@ class FTGLBitmapFontTest : public CppUnit::TestCase
     CPPUNIT_TEST_SUITE( FTGLBitmapFontTest);
         CPPUNIT_TEST( testConstructor);
         CPPUNIT_TEST( testRender);
+        CPPUNIT_TEST( testDisplayList);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -54,6 +55,23 @@ class FTGLBitmapFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testDisplayList()
+        {
+            buildGLContext();
+        
+            FTGLBitmapFont* bitmapFont = new FTGLBitmapFont( FONT_FILE);            
+            bitmapFont->FaceSize(18);
+            
+            int glList = glGenLists(1);
+            glNewList( glList, GL_COMPILE);
+
+                bitmapFont->Render(GOOD_ASCII_TEST_STRING);
+
+            glEndList();
+
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
+        }
+        
         void setUp() 
         {}
         
diff --git a/test/FTGLPixmapFont-Test.cpp b/test/FTGLPixmapFont-Test.cpp
index 70c2bf8..326084d 100644
--- a/test/FTGLPixmapFont-Test.cpp
+++ b/test/FTGLPixmapFont-Test.cpp
@@ -14,6 +14,7 @@ class FTGLPixmapFontTest : public CppUnit::TestCase
     CPPUNIT_TEST_SUITE( FTGLPixmapFontTest);
         CPPUNIT_TEST( testConstructor);
         CPPUNIT_TEST( testRender);
+        CPPUNIT_TEST( testDisplayList);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -54,6 +55,23 @@ class FTGLPixmapFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testDisplayList()
+        {
+            buildGLContext();
+        
+            FTGLPixmapFont* pixmapFont = new FTGLPixmapFont( FONT_FILE);            
+            pixmapFont->FaceSize(18);
+            
+            int glList = glGenLists(1);
+            glNewList( glList, GL_COMPILE);
+
+                pixmapFont->Render(GOOD_ASCII_TEST_STRING);
+
+            glEndList();
+
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
+        }
+        
         void setUp() 
         {}
         
diff --git a/test/FTGLTextureFont-Test.cpp b/test/FTGLTextureFont-Test.cpp
index 0d85316..9237806 100644
--- a/test/FTGLTextureFont-Test.cpp
+++ b/test/FTGLTextureFont-Test.cpp
@@ -15,6 +15,7 @@ class FTGLTextureFontTest : public CppUnit::TestCase
         CPPUNIT_TEST( testConstructor);
         CPPUNIT_TEST( testResizeBug);
         CPPUNIT_TEST( testRender);
+        CPPUNIT_TEST( testDisplayList);
     CPPUNIT_TEST_SUITE_END();
         
     public:
@@ -70,6 +71,23 @@ class FTGLTextureFontTest : public CppUnit::TestCase
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
         }
 
+        void testDisplayList()
+        {
+            buildGLContext();
+        
+            FTGLTextureFont* textureFont = new FTGLTextureFont( FONT_FILE);            
+            textureFont->FaceSize(18);
+            
+            int glList = glGenLists(1);
+            glNewList( glList, GL_COMPILE);
+
+                textureFont->Render(GOOD_ASCII_TEST_STRING);
+
+            glEndList();
+
+            CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
+        }
+        
         void setUp() 
         {}
         
diff --git a/test/FTOutlineGlyph-Test.cpp b/test/FTOutlineGlyph-Test.cpp
index f7a2a7f..d652196 100644
--- a/test/FTOutlineGlyph-Test.cpp
+++ b/test/FTOutlineGlyph-Test.cpp
@@ -33,7 +33,7 @@ class FTOutlineGlyphTest : public CppUnit::TestCase
 
             buildGLContext();
         
-            FTOutlineGlyph* outlineGlyph = new FTOutlineGlyph( face->glyph);            
+            FTOutlineGlyph* outlineGlyph = new FTOutlineGlyph( face->glyph, true);
             CPPUNIT_ASSERT( outlineGlyph->Error() == 0);
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
 
@@ -46,7 +46,7 @@ class FTOutlineGlyphTest : public CppUnit::TestCase
             
             buildGLContext();
         
-            FTOutlineGlyph* outlineGlyph = new FTOutlineGlyph( face->glyph);
+            FTOutlineGlyph* outlineGlyph = new FTOutlineGlyph( face->glyph, true);
             outlineGlyph->Render(FTPoint( 0, 0, 0));
             CPPUNIT_ASSERT( outlineGlyph->Error() == 0);
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);
diff --git a/test/FTPolyGlyph-Test.cpp b/test/FTPolyGlyph-Test.cpp
index 981a149..0993ec8 100644
--- a/test/FTPolyGlyph-Test.cpp
+++ b/test/FTPolyGlyph-Test.cpp
@@ -33,7 +33,7 @@ class FTPolyGlyphTest : public CppUnit::TestCase
             
             buildGLContext();
         
-            FTPolyGlyph* polyGlyph = new FTPolyGlyph( face->glyph);            
+            FTPolyGlyph* polyGlyph = new FTPolyGlyph( face->glyph, true);
             CPPUNIT_ASSERT( polyGlyph->Error() == 0);
         
             CPPUNIT_ASSERT( glGetError() == GL_NO_ERROR);        
@@ -47,7 +47,7 @@ class FTPolyGlyphTest : public CppUnit::TestCase
             
             buildGLContext();
         
-            FTPolyGlyph* polyGlyph = new FTPolyGlyph( face->glyph);
+            FTPolyGlyph* polyGlyph = new FTPolyGlyph( face->glyph, true);
             polyGlyph->Render(FTPoint( 0, 0, 0));           
             CPPUNIT_ASSERT( polyGlyph->Error() == 0);