Example #1
0
void Game::drawPlayTimer(GLUquadric* glQ, double time){
	int a = (int)time/10;
	int b = (int)time%10;
	double zi = -this->gameboard->size + 1.5;
	double xi = -5.0;
	setMaterial(mat5_shininess, mat5_specular, mat5_diffuse, mat5_ambient);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, 2002);
	glPushMatrix();	
		glTranslated(xi, -0.9, zi);
		glRotated(-90.0,1.0,0.0,0.0);
		gluDisk(glQ,0.0,1.5,10,2);
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);
	
	glEnable(GL_COLOR_MATERIAL);
	glPushMatrix();
		glTranslated(xi - 0.75, -0.8, zi+0.5);
		glRotatef(-90.0,1.0,0.0,0.0);
		glScalef(0.01, 0.01, 0.01);
		glColor4f(0.0, 0.0, 0.0, 1.0);
		glLineWidth(1.5);
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '1' + a-1);
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '1' + b-1);
	glPopMatrix();
	glDisable(GL_COLOR_MATERIAL);	
}
Example #2
0
void View::gameOver() {
	glPushMatrix();
	stringstream txtGameOver;
	txtGameOver << "GAME OVER";
	glColor3f(1, 0, 0); // TODO : glColor3fv
	/* Antialiasing du texte */ 

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glEnable(GL_LINE_SMOOTH);

	for(unsigned int i = 0; i < txtGameOver.str().size(); i++)
	{
		glutStrokeCharacter(GLUT_STROKE_ROMAN, txtGameOver.str()[i]);
	}

	stringstream txtScore;
	txtScore << "  Score: " << model->getScore();
	glColor3f(1, 1, 1); // TODO : glColor3fv
	/* Antialiasing du texte */ 

	for(unsigned int i = 0; i < txtScore.str().size(); i++)
	{
		glutStrokeCharacter(GLUT_STROKE_ROMAN, txtScore.str()[i]);
	}
	glPopMatrix();
}
Example #3
0
void NQueens::GLLabelState(const NQueenState &s, int x, int y, int number) const
{
	glDisable(GL_LIGHTING);
    glEnable(GL_LINE_SMOOTH);
    glDisable(GL_DEPTH_TEST);
	glLineWidth(3.0);

	int w = (int)s.locs.size();
	int h = (int)s.locs.size();
	glPushMatrix();
	glColor3f(1.0, 1.0, 1.0);
	glTranslatef(x*2.0/w-1.0, (1+y)*2.0/h-1.0, -0.001);
	glScalef(1.0/(w*120.0), 1.0/(h*120.0), 1);
	glRotatef(180, 0.0, 0.0, 1.0);
	glRotatef(180, 0.0, 1.0, 0.0);
	//glTranslatef((float)x/width-0.5, (float)y/height-0.5, 0);
	if (number > 9)
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '0'+(((number)/10)%10));
	if (number > 0)
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '0'+((number)%10));
	//glTranslatef(-x/width+0.5, -y/height+0.5, 0);
	glPopMatrix();


    glEnable(GL_DEPTH_TEST);
	glEnable(GL_LIGHTING);
    glDisable(GL_LINE_SMOOTH);
	glLineWidth(1.0);
}
/** draw
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
void ControlScreen::draw() {

	glDisable(GL_LIGHTING);

	setupProjection(m_windowWidth, m_windowHeight);

	/// green color
	glColor3f(0.7f, 1.0f, 0.3f);

	/// line
	glLineWidth(1.0f);

	/// calculate scale amount when viewHeight changes
	int baseHeight = 200;
	float ratio = (float)m_viewHeight / (float)baseHeight;
	
	glTranslatef(10.0, (GLfloat)-m_viewHeight, 0.0);
	glScalef(ratio, ratio, 1.0);

	
	/// draw player name text
	glPushMatrix();
		glTranslatef(0.0, 60.0, 0.0);
		for (char* c = m_playerName; *c != '\0'; c++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, *c);
		}
	glPopMatrix();

	/// draw timer text
	if (!m_freezeClock)
		m_currentTime = gameClock.getElapsedTime();
	// conver to string
	std::stringstream ss;
	ss << m_currentTime;

	std::string displayTime1 = ss.str();
	char* displayTime = (char*)displayTime1.c_str();

	glPushMatrix();
		glTranslatef(1000.0, 60.0, 0.0);
		for (char* c = displayTime; *c != '\0'; c++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, *c);
		}
	glPopMatrix();

	/// draw victory text
	if (m_displayVictory) {
		if (fmod(g_gameEngine->realtimeClock.getElapsedTime(), 1) < .5) {
			glPushMatrix();
			glTranslatef(1800.0, 60.0, 0.0);
			for (char* c = m_victoryText; *c != '\0'; c++) {
				glutStrokeCharacter(GLUT_STROKE_ROMAN, *c);
			}
			glPopMatrix();
		}
	}

	glEnable(GL_LIGHTING);
}
Example #5
0
void drawText() {
	glLoadIdentity();
	string text = "start";
	glLineWidth(2);	
	glColor3f(1, 1, 1);
	glPushMatrix(); {
		glTranslatef(1.6, 1.58 - 0, 0.0);
		glScalef(1 / 1500.0, 1 / 1500.0, 1 / 1500.0);
		
		for (int i = 0; i < text.length(); i++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, text[i]);
		}
	}
	glPopMatrix();
	text = "settings";
	glPushMatrix(); {
		glTranslatef(1.6, 1.58 - 0.6, 0.0);
		glScalef(1 / 1500.0, 1 / 1500.0, 1 / 1500.0);

		for (int i = 0; i < text.length(); i++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, text[i]);
		}
	}
	glPopMatrix();
	text = "credit";
	glPushMatrix(); {
		glTranslatef(1.6, 1.58 - 1.2, 0.0);
		glScalef(1 / 1500.0, 1 / 1500.0, 1 / 1500.0);

		for (int i = 0; i < text.length(); i++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, text[i]);
		}
	}
	glPopMatrix();
	
	text = "POOL";
	glPushMatrix(); {
		glLineWidth(3);
		glTranslatef(0.5, 1.58 - 0.6, 0.0);
		glScalef(1 / 1000.0, 1 / 1000.0, 1 / 1000.0);
		for (int i = 0; i < text.length(); i++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, text[i]);
		}
	}
	glPopMatrix();
	text = "GAME";
	glPushMatrix(); {
		glLineWidth(1);
		glTranslatef(0.5, 1.58 - 0.7, 0.0);
		glScalef(1 / 1000.0, 1 / 1000.0, 1 / 1000.0);
		for (int i = 0; i < text.length(); i++) {
			glutStrokeCharacter(GLUT_STROKE_ROMAN, text[i]);
		}
	}
	glPopMatrix();
}
Example #6
0
void strokeNumber(int n)
{
    if(n == 0)
        glutStrokeCharacter(GLUT_STROKE_ROMAN, '0');
    char * c = itoa(n, 10);
    for(int i = 0; c[i] != NULL; i++)
    {
        glutStrokeCharacter(GLUT_STROKE_ROMAN, c[i]);
        glTranslatef(100, 0.0, 0.0);
    }
}
Example #7
0
 void draw ( const std::string & str ) { 
     int n = str.size();
     if ( m_mono ) { 
         for ( int i = 0; i < n ; i++ ) {
             glutStrokeCharacter(  GLUT_STROKE_MONO_ROMAN , str[i] ); 
         }
     } 
     else { 
         for ( int i = 0; i < n ; i++ ) {
             glutStrokeCharacter(  GLUT_STROKE_ROMAN , str[i] ); 
         }
     }
 }
Example #8
0
void Game::drawScore(int score, double xScore, double yScore, double zScore){
	int a = (int)score/10;
	int b = (int)score%10;
	glEnable(GL_COLOR_MATERIAL);
	glPushMatrix();
		glTranslatef(xScore, yScore, zScore);
		glRotatef(-90, 1.0, 0.0, 0.0);
		glScalef(0.02, 0.02, 0.02);
		glColor4f(0.0, 0.0, 0.0, 1.0);
		glLineWidth(2.0);
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '1' + a-1);
		glutStrokeCharacter(GLUT_STROKE_ROMAN, '1' + b-1);
	glPopMatrix();
	glDisable(GL_COLOR_MATERIAL);	
}
Example #9
0
void Menu::draw()
{
    glLoadName(101);
    
    glPushMatrix();
    
    glDisable(GL_LIGHTING);
    glColor4f(0,0,0,0.5);
    
    glRotatef(-90,1,0,0);
    glTranslatef(0,0,1);
    
    window->draw();
    
    glTranslatef(-3, -1, 1);
    glScalef(0.01, 0.01, 0.01);
    glLineWidth(5);
    
    glPushMatrix();
    
    for (int i=0; i<l1; i++)
    {
        glColor4f(1, 1, 0,1);
        glutStrokeCharacter(GLUT_STROKE_ROMAN, t1[i]);
        
    }
    
    glPopMatrix();
    
    
    glPushMatrix();
    
    glLineWidth(2);
    glTranslatef(50, -300, 0);
    glScalef(0.5, 0.5, 0.5);
    
    for (int i=0; i<l2; i++)
    {
        glColor4f(1, 1, 0,1);
        glutStrokeCharacter(GLUT_STROKE_ROMAN, t2[i]);
        
    }
    
    glPopMatrix();
    
    glEnable(GL_LIGHTING);
    glPopMatrix();
}
Example #10
0
void
display(void)
{
#if 0
  int len, i;

  glClear(GL_COLOR_BUFFER_BIT);
  glPushMatrix();
  glRotatef(angle, 0.0, 0.0, 1.0);
  glTranslatef(-750, 0, 0);
  len = (int) strlen(message);
  for (i = 0; i < len; i++) {
    glutStrokeCharacter(font, message[i]);
  }
  glPopMatrix();
#else
  glPushMatrix();
  glClear(GL_COLOR_BUFFER_BIT);
  glcRotate(angle);
  glRasterPos2f(100, 100);
  glcFont(font);
  glcRenderString(message);
  glPopMatrix();
#endif
  glutSwapBuffers();
}
Example #11
0
void renderer::visit(text* t) {
    t->applyColor();

    for (int i = 0; i < t->value.count(); i++) {
        glutStrokeCharacter(GLUT_STROKE_ROMAN, t->value.at(i).unicode());
    }
}
Example #12
0
void View::drawButton(string buttonName, int deltaY) {
	int gap = 5;
	int largeur = 150;
	int hauteur = 40;
	stringstream txtScore;
	txtScore << buttonName;

	glPushMatrix();
	glTranslated(0,deltaY,0);
	glColor3f(1.0,1.0,1.0);
	glRectf(gap,0,largeur,hauteur);

	glTranslated(30,5,0);
	glScaled(0.3,0.3,1);

	// Anti-aliasing
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glEnable(GL_LINE_SMOOTH);

	glColor3f(0.0,0.0,0.0);
	for(unsigned int i = 0; i < txtScore.str().size(); i++)
	{
		glutStrokeCharacter(GLUT_STROKE_ROMAN, txtScore.str()[i]);
	}
	glPopMatrix();
}
void drawText(float x, float y, float z, const std::string & text, const Font & font) {
  	glPushMatrix();
  	glTranslatef(x, y, z);
  	glScalef(font.size, font.size, font.size);
	glPointSize(1.0);
	void *fontID=GLUT_STROKE_ROMAN;

	/*if(font.outline) {
		double y0=0.0,y1=glutStrokeHeight(fontID);
		double x0=0.0,x1=0.0;
		for(size_t i = 0; i < text.length(); ++i) x1+=glutStrokeWidth(fontID,text[i]);
		glBegin(GL_LINES);
		for(size_t i = 0; i < text.length(); ++i) {
			glVertex2f(x0,y0); glVertex2f(x1,y0);
			glVertex2f(x0,y1); glVertex2f(x1,y1);
			glVertex2f(x0,y0); glVertex2f(x0,y1);
			glVertex2f(x1,y0); glVertex2f(x1,y1);
		}
		glEnd();
	}*/

  	for(size_t i = 0; i < text.length(); ++i) {
     		glutStrokeCharacter(fontID, text[i]);
	}
  	glPopMatrix();
}
Example #14
0
bool
Tick::drawGlutText(QString str,
		   int xc0, int xc1, int yc0, int yc1,
		   float sclx, float scly,
		   float perpx, float perpy,
		   float angle, bool angleFixed, float pshift)
{
  int len = str.length();
  if (len <= 0)
    return false;

  int width = glutStrokeLength(GLUT_STROKE_ROMAN,
			       (unsigned char*)(str.toAscii().data()));

  int x = (xc0+xc1)/2;
  int y = (yc0+yc1)/2;
  x += perpx*pshift;
  y += perpy*pshift;
  if (angleFixed)
    {
      x += 0.9*perpx;
      y += 0.9*perpy;
    }

  glPushMatrix();
  glTranslatef(x, y, 0);
  glScaled(sclx, scly, 1);
  glRotatef(angle, 0, 0, 1);
  glTranslatef(-width/2, 0, 0);
  for (int i = 0; i < len; i++)
    glutStrokeCharacter(GLUT_STROKE_ROMAN, (str[i].toAscii()));
  glPopMatrix();
  
  return true;
}
void GraphicsDisplayText(char *string, float size, matrix &pos)
{
	static matrix p;
	void *font = GLUT_STROKE_MONO_ROMAN;
	int i, w;
	float s = size*0.05;

	p = pos;
	w = strlen(string);

	p(1, 1) -= (w / 2) * (s * 100.0);
	p(2, 1) += 100;

	glPushMatrix();

	glLineWidth(2.0);
	translate(p);
	glRotated(90, 1.0, 0.0, 0.0);
	glScalef(s, s, 1);
	

	GRAPHICS_ColorSet(WHITE);

	for (i = 0; (i < w); i++)
		glutStrokeCharacter(font, string[i]);

	glPopMatrix();
}
Example #16
0
void RadarObject::drawLabels() {

	for (int t = 0; t < 2; t++) {
		glPushMatrix();
		switch (getRadial().quadrant()) {
		case Angle::Angle_Quad_A:
			glTranslatef(0.03, 0.03 - 0.015 * t, 0);
			break;
		case Angle::Angle_Quad_B:
			glTranslatef(0.03, -0.03 - 0.015 * t, 0);
			break;
		case Angle::Angle_Quad_C:
			glTranslatef(-0.2, -0.03 - 0.015 * t, 0);
			break;
		case Angle::Angle_Quad_D:
			glTranslatef(-0.2, 0.03 - 0.015 * t, 0);
			break;
		}

		glScalef(0.0001, 0.0001, 0);
		int l = strlen(currentInformation.getText().texts[t]);
		for (int i = 0; i < l; i++)
			glutStrokeCharacter(&glutStrokeMonoRoman,
					currentInformation.getText().texts[t][i]);
		glPopMatrix();
	}

}
// functie pentru output text
void output(GLfloat x, GLfloat y, char *format,...)
{
	va_list args;

	char buffer[1024],*p;

	va_start(args,format);

	vsprintf_s(buffer, format, args);

	va_end(args);

	glPushMatrix();
	
	glTranslatef(x,y,24);

	glRotatef(-90,1,0,0);

	glScalef(0.02, 0.02, 0.0); /* 0.1 to 0.001 as required */


	for (p = buffer; *p; p++)
		glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, *p);

	glPopMatrix();
}
Example #18
0
void glprintf(const char *fmt, ...)
{
    float       length=0;                               // Used To Find The Length Of The Text
    char        text[256];                              // Holds Our String
    va_list     ap;                                     // Pointer To List Of Arguments
    int i,tl;

    if (fmt==0) return;

    va_start(ap, fmt);                                  // Parses The String For Variables
    vsprintf(text, fmt, ap);                            // And Converts Symbols To Actual Numbers
    va_end(ap);                                         // Results Are Stored In Text

    tl=strlen(text);
    for(i=0;i<tl;i++) {
        length+=glutStrokeWidth(GLUT_STROKE_MONO_ROMAN,text[i]);
    } /* for /*/

    glTranslatef(-length/2,0.0f,0.0f);                  // Center Our Text On The Screen

    glNormal3f(0.0,0.0,1.0);
    for(i=0;i<tl;i++) {
        glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN,text[i]);
    } /* for */
} /* glprintf */
Example #19
0
void
RenderString(float x, float y, char *string)
{
	GLfloat size = 0.0009f;
	int len, i;

	glPushMatrix();
	glLoadIdentity();
	glTranslatef(x, y, -1.2f);
	glScalef(size, size, size);
	len = (int) strlen(string);

#ifdef SMOOTH_TEXT
	glEnable(GL_LINE_SMOOTH);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif

	for (i = 0; i < len; i++)
		glutStrokeCharacter(GLUT_STROKE_ROMAN, string[i]);
	glPopMatrix();

#ifdef SMOOTH_TEXT
	glDisable(GL_BLEND);
	glDisable(GL_LINE_SMOOTH);
#endif
}
Example #20
0
void XMLScene::print(int x, int y, int z, string s)
{
	/*
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW); 
	glPushMatrix();
	glLoadIdentity();
	*/	glDisable(GL_LIGHTING);
//set the position of the text in the window using the x and y coordinates
glPushMatrix();
glColor3f(1.0,0,0.0);		// amarelo
glTranslatef(x,y,z);
glScalef(0.01,0.01,0.01);

//loop to display character by character
for (int i = 0; i < s.size(); i++) 
{
	//glutStrokeCharacter(GLUT_STROKE_ROMAN,string[i]);
	glutStrokeCharacter(GLUT_STROKE_ROMAN,s[i]);
}
glPopMatrix();
//glEnable(GL_DEPTH_TEST);
//glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
/*

glMatrixMode(GL_PROJECTION);
glPopMatrix();

glMatrixMode(GL_MODELVIEW);
glPopMatrix();*/
};
Example #21
0
void scaledglprintf2(float sx,float sy,const char *fmt, ...)
{

    //printf("x=%f, y=%f, %s\n\n",sx, sy,fmt);

    float       length=0;                               // Used To Find The Length Of The Text
    char        text[256];                              // Holds Our String
    va_list     ap;                                     // Pointer To List Of Arguments
    int i,tl;

    va_start(ap, fmt);                                  // Parses The String For Variables
    vsprintf(text, fmt, ap);                            // And Converts Symbols To Actual Numbers
    va_end(ap);                                         // Results Are Stored In Text

    tl=strlen(text);
    for(i=0;i<tl;i++) {
        length+=glutStrokeWidth(GLUT_STROKE_MONO_ROMAN,text[i]);
    }

    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glScalef(sx,sy,1.0f);

    glNormal3f(0.0,0.0,1.0);
    for(i=0;i<tl;i++) {
        glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN,text[i]);

    }

    glPopMatrix();

} /* scaledglprintf2 */
Example #22
0
void InputBox::drawInputString(){
	glPushMatrix();
	glPushAttrib(GL_LINE_BIT);
		glColor3f(1.0, 1.0, 1.0);
		glLineWidth(1.5f);
		glTranslatef(point.getX() - width/2 + .025, point.getY() - .09, 0);
		glScalef(0.003,0.003,0.001);
		for(unsigned int a = 0; a < input_string.length(); a++){
			if(is_password)
				glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, '*');
			else
				glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, input_string[a]);
		}
	glPopAttrib();
	glPopMatrix();
}
Example #23
0
static void DrawStrokeString(void *font, const char *string)
{
    int i;

    for (i = 0; string[i]; i++)
	glutStrokeCharacter(font, string[i]);
}
Example #24
0
void glprint(char *mode, char *sentence)
{
	int i = 0;
	glPushMatrix();

	if (strcmp(mode, "roman") == 0){
		while (sentence[i] != '\0'){
			glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, sentence[i]);
			i++;
		}
	}
	else if (strcmp(mode, "bitmap") == 0){
		while (sentence[i] != '\0'){
			glutBitmapCharacter(GLUT_BITMAP_9_BY_15, sentence[i]);
			i++;
		}
	}
	else if (strcmp(mode, "stroke") == 0){
		glScaled(0.01, 0.01, 0.01);
		while (sentence[i] != '\0'){
			glutStrokeCharacter(GLUT_STROKE_ROMAN, sentence[i]);
			i++;
		}
	}
	else printf("Error !");

	glPopMatrix();
}
Example #25
0
//metodo que dibuja el texto quue hay en la matriz texto
void graficos::textodisplay(){

	glDisable(GL_LIGHTING);
	glPushAttrib(GL_CURRENT_BIT);
		//glRotatef(xRot/16,0,1,0);
		//glRotatef(yRot/16,1,0,0);

		glPushMatrix();
			glTranslatef(-3,5,0);
			glScalef(0.7,0.7,0.7);
			glRotatef(-45,1,0,0);
	
			for(int l=0; l<filas; l++){
				int letras = (int)strlen(texto[l]);
				glPushMatrix();
				glTranslatef(-8.0,4.0-(1*l),0);
				glScalef(0.005,0.005,0.005);
				for (int i=0; i<letras; i++){
					glColor3f(1.0,1.0,1.0);
					glLineWidth(3);
					glutStrokeCharacter(GLUT_STROKE_ROMAN, texto[l][i]);
				}
				glPopMatrix();
			}
		glPopMatrix();
	glPopAttrib();
	glEnable(GL_LIGHTING);

}
Example #26
0
/** StrokeCharacter(font, string) -> None
 */
static int glut_stroke_character(lua_State *L) {
  void *e;

   /* test argument */
  if(!lua_isstring(L, 1) || !lua_isstring(L, 2))
    luaL_error(L, "incorrect argument to function 'gl.StrokeCharacter'");

  e = get_glut_enum(L, 1);

   /* test argument */
  if(e == ENUM_ERROR)
    luaL_error(L, "incorrect string argument to function 'gl.StrokeCharacter'");


  const char *p = lua_tostring(L, 2);
  int c;

  glPushMatrix();
    while ( (c = *p) ) {
      if (c < 32 || c > 127) {
        glPopMatrix();
        luaL_error(L, "incorrect character in function 'gl.StrokeCharacter'");
      }
      glutStrokeCharacter((void*)e, c);
      ++p;
    }
  glPopMatrix();
  return 0;
}
Example #27
0
/**
 * dibuja un string. Tomado de shapes.c
 */
void drawstr(GLuint x, GLuint y, GLdouble scale, char* format, ...)
{
  va_list args;
  char buffer[255], *s;

  glPushMatrix();

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0.0, screen_width, screen_height, 0.0);

  glMatrixMode(GL_MODELVIEW); 
  glLoadIdentity();
  glTranslatef(x,y+2,0);
  glScalef(scale,scale,scale);
  glRotatef(180,1,0,0);
  glColor3f(1.0, 1.0, 1.0);

  va_start(args, format);
  vsprintf(buffer, format, args);
  va_end(args);
    
  for (s = buffer; *s; s++)
    glutStrokeCharacter(font_style, *s);

  glPopMatrix();
}
Example #28
0
void text(const char *str,float size)
{
    glPushMatrix();
    glScalef(size,size,size);
    for (int i=0;i<strlen(str);i++)
	glutStrokeCharacter(GLUT_STROKE_ROMAN,str[i]);
    glPopMatrix();
}
Example #29
0
void strokeSpString(char *string)
{
	char *c;
  for (c=string; *c != '\0'; c++)
  {
    glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, *c);
  }
}
void Line::display()
{
    //Logger::Log("Entering Line.display...", LOG_DEBUG);

    Glutter::RenderStyle(STYLE_SMOOTH_LINE);

    glPushMatrix(); // as received

    glTranslated(0.0, -mY, 0.0);                                  // shift down
    glScalef(mScale, mScale, 1.0);                                // scale down text

    glLineWidth(1.0);                                             // todo: alter by style

    float lShift;
    for (int lIndex = 0; lIndex < (int)mText.length(); lIndex++)
    {
        // select character
        char lChar = mText[lIndex];

        glNormal3f(0.0, 0.0, 1.0);

        // alter transparency
        if (lIndex < mFixedChars)
        {
            glColor4f(0.0, 0.0, 0.3, 1.0);
            glutStrokeCharacter(mFont, lChar);

        }
        else
        {
            if (mVisibility > 0.0)
            {
                lShift = 1.0 - mVisibility;
                glColor4f(0.0, 0.0, 0.3, mVisibility);
                glTranslatef(0.0, 0.0, lShift);
                glutStrokeCharacter(mFont, lChar);
                glTranslatef(0.0, 0.0, -lShift);

            }
        }

    }

    glPopMatrix(); // as received
}