InfoExampleUI()
        : UI(405, 256)
    {
        std::memset(fParameters, 0, sizeof(float)*kParameterCount);
        std::memset(fStrBuf, 0, sizeof(char)*(0xff+1));

        fSampleRate = getSampleRate();
        fFont       = createFontFromFile("sans", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
    }
Exemple #2
0
	//virtual 
	bool FTGLFontDrawingObj::Draw()
	{
		glEnable(GL_TEXTURE_2D);

		//auto texFont = getFont(FTGLFT_Texture);

		UINT fontHeight = 12;
		//texFont->FaceSize(fontHeight);

		//if ( !texFont->Error() )
		//	cout << "After facesize error!!" << endl;

		//texFont->Render("g");

		Point3D leftBottomPt, rightTopPt;
		//texFont->BBox("g", leftUpPt.x, leftUpPt.y, leftUpPt.z, rightBottomPt.x, rightBottomPt.y, rightBottomPt.z);

		//glPushMatrix();
		//glTranslatef(rightBottomPt.x - leftUpPt.x + 10, 0.0, 0.0);
		//glRotatef(45.0f, 0.0, 1.0f, 0);
		//glRotatef(45.0f, 1.0, 0, 0);
		//texFont->Render("g");
		//glPopMatrix();

		//Unit3f curBegPt(0, -(rightBottomPt.y - leftUpPt.y + 10), 0);

		//glTranslatef(curBegPt.x, curBegPt.y, curBegPt.z);

		//auto polyFont = getFont(FTGLFT_Polgon);
		auto polyFont = createFontFromFile(FTGLFT_Polgon);
		polyFont->FaceSize(fontHeight);

		string str(TEXT("fgp1234"));

		polyFont->BBox(str.c_str(), leftBottomPt.x, leftBottomPt.y, leftBottomPt.z, rightTopPt.x, rightTopPt.y, rightTopPt.z);

		glColor3f(1.0, 1.0, 1.0);
		polyFont->Render(str.c_str());

		glColor3f(1.0, 0.0, 0.0);
		draw_box(leftBottomPt, rightTopPt);

		glPushMatrix();
		glTranslatef(rightTopPt.x - leftBottomPt.x, 0.0, 0.0);
		glColor3f(1.0, 1.0, 1.0);
		polyFont->Render(str.c_str());
		glColor3f(0.0, 1.0, 0.0);
		draw_box(leftBottomPt, rightTopPt);
		glPopMatrix();

		glPushMatrix();
		glTranslatef(0.0, rightTopPt.y - leftBottomPt.y, 0.0);
		glColor3f(1.0, 1.0, 1.0);
		polyFont->Render(str.c_str());
		glColor3f(0.0, 0.0, 1.0);
		draw_box(leftBottomPt, rightTopPt);
		glPopMatrix();

		glDisable(GL_TEXTURE_2D);

		return true;
	}