Commit 25e3956acaf396f493678ea6374a2f2594d3c825

henry 2001-10-28T04:05:48

Got rid of the static and moved the glBegin/glEnd pairs

diff --git a/include/FTTextureGlyph.h b/include/FTTextureGlyph.h
index 6de75cc..5ae34a8 100755
--- a/include/FTTextureGlyph.h
+++ b/include/FTTextureGlyph.h
@@ -50,12 +50,11 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
 		/**
 		 * The texture index of the currently active texture
 		 *
-		 * Because a a full set of glyphs may not fit on one glyph we need
-		 * to keep track of the current active texture to try to reduce the
-		 * number of texture bind operations
+		 * We call glGetIntegerv( GL_TEXTURE_2D_BINDING, activeTextureID);
+		 * to get the currently active texture to try to reduce the number
+		 * of texture bind operations
 		 */
-		// Replace this with glGetIntegerv( GL_TEXTURE_2D_BINDING, activeTextureID);
-		static int activeTextureID;
+		GLint activeTextureID;
 		
 	private:
 		/**
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index 8e17b9e..e874dbb 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -2,8 +2,6 @@
 #include	"FTGL.h"
 
 
-int FTTextureGlyph::activeTextureID = 0;
-
 FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, unsigned char* data, int stride, int height, float u, float v)
 :	FTGlyph(),
 	destWidth(0),
@@ -72,20 +70,20 @@ FTTextureGlyph::~FTTextureGlyph()
 
 float FTTextureGlyph::Render( const FT_Vector& pen)
 {
-	// This could be really ugly!!
+	glGetIntegerv( GL_TEXTURE_2D_BINDING_EXT, &activeTextureID);
 	if( activeTextureID != glTextureID)
 	{
-		glEnd();
 		glBindTexture( GL_TEXTURE_2D, (GLuint)glTextureID);
-		activeTextureID = glTextureID;
-		glBegin( GL_QUADS);
 	}
 	
+	glBegin( GL_QUADS);
 	glTexCoord2f( uv[0].x, uv[0].y); glVertex2f( pen.x + pos.x,				pen.y + pos.y);
 	glTexCoord2f( uv[1].x, uv[0].y); glVertex2f( pen.x + destWidth + pos.x,	pen.y + pos.y);
 	glTexCoord2f( uv[1].x, uv[1].y); glVertex2f( pen.x + destWidth + pos.x,	pen.y + pos.y - destHeight);
 	glTexCoord2f( uv[0].x, uv[1].y); glVertex2f( pen.x + pos.x,				pen.y + pos.y - destHeight);
+	glEnd();
 
 	return advance;
+
 }