Commit 6a024aef654f8db6ee66faa2e9f407e996efb702

henry 2001-09-16T21:52:46

Updated for changes in *Glyph classes. Added unicode render function. Updated comments

diff --git a/include/FTGLBitmapFont.h b/include/FTGLBitmapFont.h
index e92a510..cf827af 100755
--- a/include/FTGLBitmapFont.h
+++ b/include/FTGLBitmapFont.h
@@ -6,22 +6,53 @@
 
 class FTBitmapGlyph;
 
+/**
+ * FTGLBitmapFont is a specialisation of the FTFont class for handling
+ * Bitmap fonts
+ *
+ * @see		FTFont
+ */
 class	FTGLBitmapFont : public FTFont
 {
 	public:
-		// methods
+		/**
+		 * Constructor
+		 */
 		FTGLBitmapFont();
+
+		/**
+		 * Destructor
+		 */
 		~FTGLBitmapFont();
 		
+		/**
+		 * Renders a string of characters
+		 * 
+		 * @param string	'C' style string to be output.	 
+		 */
 		void render( const char* string);
 
+		/**
+		 * Renders a string of characters
+		 * 
+		 * @param string	'C' style string to be output.	 
+		 */
+		void render( const wchar_t* string);
+
 		// attributes
 		
 	private:
-		// methods
+		/**
+		 * Constructs the internal glyph cache.
+		 *
+		 * This a list of glyphs processed for openGL rendering NOT
+		 * freetype glyphs
+		 */
 		bool MakeGlyphList();
 		
-		// attributes
+		/**
+		 * Temp variable for a FTBitmapGlyph
+		 */
 		FTBitmapGlyph* tempGlyph;
 		
 };
diff --git a/include/FTGLOutlineFont.h b/include/FTGLOutlineFont.h
index 9c77bfc..f586b6f 100755
--- a/include/FTGLOutlineFont.h
+++ b/include/FTGLOutlineFont.h
@@ -8,6 +8,12 @@
 
 class FTVectorGlyph;
 
+/**
+ * FTGLOutlineFont is a specialisation of the FTFont class for handling
+ * Vector Outline fonts
+ *
+ * @see		FTFont
+ */
 class	FTGLOutlineFont : public FTFont
 {
 	public:
@@ -16,6 +22,7 @@ class	FTGLOutlineFont : public FTFont
 		~FTGLOutlineFont();
 		
 		void render( const char* string);
+		void render( const wchar_t* string);
 
 		// attributes
 		
diff --git a/include/FTGLPixmapFont.h b/include/FTGLPixmapFont.h
index 2cd5766..d0422bd 100755
--- a/include/FTGLPixmapFont.h
+++ b/include/FTGLPixmapFont.h
@@ -6,6 +6,12 @@
 
 class FTPixmapGlyph;
 
+/**
+ * FTGLPixmapFont is a specialisation of the FTFont class for handling
+ * Pixmap (Grey Scale) fonts
+ *
+ * @see		FTFont
+ */
 class	FTGLPixmapFont : public FTFont
 {
 	public:
@@ -14,6 +20,7 @@ class	FTGLPixmapFont : public FTFont
 		~FTGLPixmapFont();
 		
 		void render( const char* string);
+		void render( const wchar_t* string);
 
 
 	private:
diff --git a/include/FTGLPolygonFont.h b/include/FTGLPolygonFont.h
index fc12078..27c41ce 100755
--- a/include/FTGLPolygonFont.h
+++ b/include/FTGLPolygonFont.h
@@ -8,6 +8,12 @@
 
 class FTPolyGlyph;
 
+/**
+ * FTGLPolygonFont is a specialisation of the FTFont class for handling
+ * tesselated Polygon Mesh fonts
+ *
+ * @see		FTFont
+ */
 class	FTGLPolygonFont : public FTFont
 {
 	public:
diff --git a/include/FTGLTextureFont.h b/include/FTGLTextureFont.h
index c221db0..81e296b 100755
--- a/include/FTGLTextureFont.h
+++ b/include/FTGLTextureFont.h
@@ -6,7 +6,13 @@
 
 class FTTextureGlyph;
 
-class	FTGLTextureFont : public FTFont
+/**
+ * FTGLTextureFont is a specialisation of the FTFont class for handling
+ * Texture mapped fonts
+ *
+ * @see		FTFont
+ */
+class FTGLTextureFont : public FTFont
 {
 	public:
 		// methods
@@ -17,6 +23,7 @@ class	FTGLTextureFont : public FTFont
 		virtual int TextureHeight() const { return textureHeight;}
 		
 		virtual void render( const char* string);
+		virtual void render( const wchar_t* string);
 
 		
 	private:
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index e301c9c..c85e18c 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -25,7 +25,7 @@ bool FTGLBitmapFont::MakeGlyphList()
 
 		if( ftGlyph)
 		{
-			tempGlyph = new FTBitmapGlyph( *ftGlyph, c);
+			tempGlyph = new FTBitmapGlyph( *ftGlyph);
 			glyphList->Add( tempGlyph);
 		}
 		else
@@ -52,3 +52,19 @@ void FTGLBitmapFont::render( const char* string)
 	glPopClientAttrib();
 
 }
+
+
+void FTGLBitmapFont::render( const wchar_t* string)
+{	
+	glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
+	
+	// doing this every frame is a bad?
+	glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE);
+	glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
+	glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
+
+	FTFont::render( string);
+
+	glPopClientAttrib();
+
+}
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index 092ba9c..bfe7122 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -23,7 +23,7 @@ bool FTGLOutlineFont::MakeGlyphList()
 		
 		if( ftGlyph)
 		{
-			tempGlyph = new FTVectorGlyph( *ftGlyph, n);
+			tempGlyph = new FTVectorGlyph( *ftGlyph);
 			glyphList->Add( tempGlyph);
 		}
 		else
@@ -50,3 +50,19 @@ void FTGLOutlineFont::render( const char* string)
 	glPopAttrib();
 
 }
+
+
+void FTGLOutlineFont::render( const wchar_t* string)
+{	
+	glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_PIXEL_MODE_BIT);
+	
+	glEnable( GL_LINE_SMOOTH);
+	glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
+	glEnable(GL_BLEND);
+ 	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
+
+	FTFont::render( string);
+
+	glPopAttrib();
+
+}
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index f564132..e00d1f9 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -25,7 +25,7 @@ bool FTGLPixmapFont::MakeGlyphList()
 	
 		if( ftGlyph)
 		{
-			tempGlyph = new FTPixmapGlyph( *ftGlyph, c);
+			tempGlyph = new FTPixmapGlyph( *ftGlyph);
 			glyphList->Add( tempGlyph);
 		}
 		else
@@ -50,3 +50,17 @@ void FTGLPixmapFont::render( const char* string)
 	glPopAttrib();
 
 }
+
+
+void FTGLPixmapFont::render( const wchar_t* string)
+{	
+	glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT);
+
+	glEnable(GL_BLEND);
+ 	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+	FTFont::render( string);
+
+	glPopAttrib();
+
+}
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index b1cd35d..7cbb1ed 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -22,7 +22,7 @@ bool FTGLPolygonFont::MakeGlyphList()
 		
 		if( ftGlyph)
 		{
-			tempGlyph = new FTPolyGlyph( *ftGlyph, n);
+			tempGlyph = new FTPolyGlyph( *ftGlyph);
 			glyphList->Add( tempGlyph);
 		}
 		else
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index c7e1c4c..af0c152 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -122,7 +122,7 @@ unsigned int FTGLTextureFont::FillGlyphs( unsigned int glyphStart, int id, int w
 			
 			currTextU = (float)currentTextX / (float)width;
 			
-			tempGlyph = new FTTextureGlyph( *ftGlyph, n, id, data, width, height, currTextU, currTextV);
+			tempGlyph = new FTTextureGlyph( *ftGlyph, id, data, width, height, currTextU, currTextV);
 			glyphList->Add( tempGlyph);
 
 			currentTextX += glyphWidth;
@@ -189,3 +189,21 @@ void FTGLTextureFont::render( const char* string)
 	
 	glPopAttrib();
 }
+
+
+void FTGLTextureFont::render( const wchar_t* string)
+{	
+	glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_PIXEL_MODE_BIT);
+	
+	glEnable(GL_BLEND);
+ 	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
+ 	
+	glBindTexture( GL_TEXTURE_2D, (GLuint)FTTextureGlyph::activeTextureID);
+
+ 	// QUADS are faster!? Less function call overhead?
+ 	glBegin( GL_QUADS);
+ 		FTFont::render( string);
+ 	glEnd();
+	
+	glPopAttrib();
+}