Adding support for turning off display lists in FTGL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
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);