From 0cbdadcfe1ec3430425928a62a6932c3ba9567be Mon Sep 17 00:00:00 2001
From: Oliver Bock <oliver.bock@aei.mpg.de>
Date: Thu, 10 Apr 2008 17:02:03 +0200
Subject: [PATCH] Refined OGLFT tests (all faces but "Filled" do work)

* Grayscale faces do need a backgorund color
* Texture faces do need enabled textures (oh well)
* Translucent faces need activated alpha blending (you guessed it)
---
 Starsphere.cpp | 21 +++++++++++++++------
 Starsphere.h   |  2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Starsphere.cpp b/Starsphere.cpp
index 16bb0a0..214cc6f 100644
--- a/Starsphere.cpp
+++ b/Starsphere.cpp
@@ -512,13 +512,17 @@ void Starsphere::initialize(const int width, const int height, const Resource *f
 	// create font instance using font resource (base address + size)
 	m_PolygonFont = new FTGLPolygonFont(&font->data()->at(0), font->data()->size());
 	
-//	face = new OGLFT::Outline( "LiberationSans-Regular.ttf", 6, 72 );
-	face = new OGLFT::Outline(&font->data()->at(0), font->data()->size(), 6, 72 );
+	face = new OGLFT::TranslucentTexture( "LiberationSans-Regular.ttf", 17, 100 );
+//	face = new OGLFT::Outline(&font->data()->at(0), font->data()->size(), 6, 72 );
 	if ( face == 0 || !face->isValid() ) {
 	     cerr << "Could not construct face" << endl;
 	}
+#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
+	glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
+#endif
 	glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-	face->setForegroundColor( 1., 0., 0. );
+	face->setForegroundColor( 1.0, 1.0, 0.0, 1.0 );
+//	face->setBackgroundColor( 0.0, 0.0, 0.0, 0.0 );
 	
 	m_PolygonFont->CharMap(ft_encoding_unicode);
 //	m_PolygonFont->Depth(0.05);
@@ -715,9 +719,14 @@ void Starsphere::render(const double timeOfDay)
 			
 			glColor3f(1.0, 1.0, 0.0);
 			glTranslatef(xStartPosLeft, yStartPosTop, 0);
-			glScalef(fontScaleLarge, fontScaleLarge, 1.0);
-			m_PolygonFont->Render("Einstein@Home");
-			face->draw(0.0, -20.0, "Einstein@Home");
+//			glScalef(fontScaleLarge, fontScaleLarge, 1.0);
+			glScalef(0.001, 0.001, 1.0);
+//			m_PolygonFont->Render("Einstein@Home");
+			glEnable( GL_TEXTURE_2D );
+			glEnable(GL_DEPTH_TEST);
+			face->draw(0.0, -10.0, "Einstein@Home");
+			glDisable(GL_DEPTH_TEST);
+			glDisable( GL_TEXTURE_2D );
 
 			glLoadIdentity();
 			glColor4f(1.0, 1.0, 1.0, 0.5);
diff --git a/Starsphere.h b/Starsphere.h
index 4f47ba3..04b102d 100644
--- a/Starsphere.h
+++ b/Starsphere.h
@@ -127,7 +127,7 @@ private:
 
 	// resource handling
 	FTFont *m_PolygonFont;
-	OGLFT::Outline* face;
+	OGLFT::TranslucentTexture* face;
 	
 	// local HUD contents
 	string m_UserName;
-- 
GitLab