/************************************************************************

	Function:		drawButtonText

	Description:	This function draws the text for all four button

*************************************************************************/
void drawButtonText(void) {

	// Set color to yellow
	glColor3f(1, 1, 0);

	// Morph text position
	glRasterPos3f(buttons[0][0]+0.02f , buttons[0][1]-0.12f ,0.0f);
	// Text for morph button
	glutBitmapString( GLUT_BITMAP_HELVETICA_18 , "MORPH" );

	// Sparkle text position
	glRasterPos3f(buttons[1][0]+0.02f , buttons[1][1]-0.12f ,0.0f);
	// Text for sparkle button
	glutBitmapString( GLUT_BITMAP_HELVETICA_18 , "SPARKLE" );

	// Sparks text position
	glRasterPos3f(buttons[2][0]+0.02f , buttons[2][1]-0.12f ,0.0f);
	// Text for sparks button
	glutBitmapString( GLUT_BITMAP_HELVETICA_18 , "SPARKS" );

	// Bonus text position
	glRasterPos3f(buttons[3][0]+0.02f , buttons[3][1]-0.12f ,0.0f);
	// Text for bonus button
	glutBitmapString( GLUT_BITMAP_HELVETICA_18 , "BONUS" );
}
Example #2
0
void text(char str[],double x,double y,double z=0,int choice=1)
{
    glColor3d(0.0,0.0,0.0);
    glRasterPos3d(x,y,z);
    if(choice)glutBitmapString(GLUT_BITMAP_HELVETICA_12,(const unsigned char*)str);
    else glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_10,(const unsigned char*)str);
}
Example #3
0
void text(char str[],double x,double y,int choice=0)
{
    glColor3d(0.0,0.0,0.0);
    glRasterPos2d(x,y);
    if(!choice)glutBitmapString(GLUT_BITMAP_HELVETICA_12,(const unsigned char*)str);
    else glutBitmapString(GLUT_BITMAP_HELVETICA_18,(const unsigned char*)str);
}
Example #4
0
void draw_meta()
{
	glDisable(GL_LIGHTING);
    glClear(GL_COLOR_BUFFER_BIT); // clear screen, to glClearColor()
    glColor3f(1.0,1.0,1.0);
	glRasterPos2f(-15, -20);
	int len, i;
	string s = "Level: ";
	string c = p.get_level();
	string fin = s + c;
	const char* a = fin.c_str();
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) a);

	string fin2 = "" ;
	if(mute)
	{
		fin2 = "Press m to unmute";
	}
	else{
		fin2 = "Press m to mute";
	}
	const char* a2 = fin2.c_str();
	glRasterPos2f(-2, -20);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) a2);

	glEnable(GL_LIGHTING);

}
void display(void)
{
  char *ar = "angle of throw is ";
  int n;
  float eta = (theta*180)/pi;
  n = eta;
  char str[15];
  sprintf(str, "%d", n);
  glClear(GL_COLOR_BUFFER_BIT);
  glClearColor(0.7f,0.9f,1.0f,0.0f);
  glRasterPos2i(xl, yl);
  glutBitmapString(GLUT_BITMAP_HELVETICA_18, ar);
  glutBitmapString(GLUT_BITMAP_HELVETICA_18, str);
  glBegin(GL_LINES);
  glVertex2f(x_0,y_0);
  glVertex2f(xl,yl);
  glEnd();
  glPointSize(50.0);
  glBegin(GL_POINTS);
  glColor3f(1.0,0.0,0.0);
  glVertex2f(xt,yt);
  glEnd();
  glPointSize(2.0);
  glBegin(GL_POINTS);
  glColor3f(0.0,0.0,0.0);
  calc();
  int i;
  for(i=0;i<draw_endpoint;i++)
  glVertex2f(X[i],Y[i]);
  glEnd();
  glFlush();
}
Example #6
0
void tegnMeny(void){	
	char setning[200];
	glColor3f(1.0,1.0,1.0); // hvit farge
	
	glPushAttrib(GL_ENABLE_BIT); 
			
		glRasterPos2f(-0.8,-0.6);
		sprintf(setning,"%s","Meny: ");
		glutBitmapString(GLUT_BITMAP_HELVETICA_18, setning);
		
		glRasterPos2f(-0.8,-0.8);
		sprintf(setning,"%s","Visualiser Krefter: 'I'    |     Boyemoment : 'B'      |      MomentDiagram: 'M'");
		glutBitmapString(GLUT_BITMAP_HELVETICA_18, setning);
		
		glRasterPos2f(-0.8,-1.0);
		sprintf(setning,"%s"," Skru av Visualiser Krefter: 'O' ");
		glutBitmapString(GLUT_BITMAP_HELVETICA_18, setning);
		
		glRasterPos2f(-0.8,-1.2);
		sprintf(setning,"%s","Skjaerkraft: 'V'    |     Relativt Boyemoment: 'R'    |  Lukk vinduet : 'Esc'");
		glutBitmapString(GLUT_BITMAP_HELVETICA_18, setning);
		
		glRasterPos2f(-0.8,-1.4);
		sprintf(setning,"%s","Minsk skaleringen : 'Z'    |     Heve skaleringen: 'X' ");
		glutBitmapString(GLUT_BITMAP_HELVETICA_18, setning);
	
	glPopAttrib();
}
Example #7
0
void displayScoreboard(){
	char sc[100];
	sprintf(sc,"Score:%d Lives:%d Level:%d",score,lives,level);
	glRasterPos3d(100,810 ,0.0);
	glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24,(unsigned char*)sc );
	sprintf(sc,"HighScore:%d (%s)",hs,playerHigh);
	glRasterPos3d(100,770 ,0.0);
	glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24,(unsigned char*)sc );
}
Example #8
0
void title_draw_menu(void)
{
    int i;
    ortho_mode(0, 0, _width, _height);
    int offset;
    float sine_value;

    // blend my friend
    glDisable(GL_DEPTH_TEST);
    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    
    // background
    glColor4f(0, 0, 0, 0.5);
    glBegin(GL_QUADS);
        glVertex3f(0, _height-150, 0); // abajo izquierda
        glVertex3f(_width, _height-150, 0); // abajo derecha
        glVertex3f(_width, 250, 0); // arriba derecha
        glVertex3f(0, 250, 0); // arriba izquierda
    glEnd();
    
    // text
    for (i = 0; i < 4; i++) {
        sine_value = (sin(i + glutGet(GLUT_ELAPSED_TIME)/300.0))/3 + 0.6;
        
        if (menu_selected == i) {
            glBegin(GL_QUADS);
                glColor4f(1, 0, 0, 0.7);
                glVertex3f(0, _height-290+30*i, 0); // abajo izquierda
                glVertex3f(_width, _height-290+30*i, 0); // abajo derecha
                glVertex3f(_width, _height-290-30+30*i, 0); // arriba derecha
                glVertex3f(0, _height-290-30+30*i, 0); // arriba izquierda
            glEnd();
        } 
        
        sprintf(_debug_string, "sine: %f", sine_value);
        offset = (_width - glutBitmapLength(GLUT_BITMAP_HELVETICA_18, (unsigned char *) menu_option_strings[i]))/2;
        glColor4f(1, 1, 1, sine_value);
        glRasterPos2i(offset, 300 + i*30);
        glutBitmapString(GLUT_BITMAP_HELVETICA_18, (unsigned char *) menu_option_strings[i]);
    }
        

    offset = (_width - glutBitmapLength(GLUT_BITMAP_HELVETICA_10, (unsigned char *) "Federico Caceres, Sergio Stanichevsky : Diciembre 2009 : Ing. Informatica : Informatica 3 : Trabajo Practico Final"))/2;
    glColor4f(1, 1, 1, 1);
    glRasterPos2i(offset, _height - 10);
    glutBitmapString(GLUT_BITMAP_HELVETICA_10, (unsigned char *) "Federico Caceres, Sergio Stanichevsky : Diciembre 2009 : Ing. Informatica : Informatica 3 : Trabajo Practico Final");
        
    
    glDisable (GL_BLEND);
    glEnable(GL_DEPTH_TEST);

    perspective_mode();
}
Example #9
0
void quads::draw() {
	if (open)
		if (!mine) {
			glColor3f(0, 1, 0);
			glRasterPos2i(16 * (number%set.width), 16 * int(number / set.width));
			unsigned char figure[2] = { '0' + this->figure };
			glutBitmapString(GLUT_BITMAP_9_BY_15, figure);
		}
		else {
			glColor3f(0, 1, 0);
			glRasterPos2i(16 * (number%set.width), 16 * int(number / set.width));
			unsigned char mine[2] = { char(1) };
			glutBitmapString(GLUT_BITMAP_9_BY_15, mine);
		}
}
Example #10
0
void GlutHelpWindow::glDraw() {
	if (isVisible) {
		glDisable(GL_LIGHTING);
		glDisable(GL_TEXTURE_2D);
		glColor4f(0.5,0.5,0.5,0.75);
		glPushMatrix();
		glTranslatef(x,y,0);
		glBegin(GL_QUADS);
		glVertex2i(0,h-40);
		glVertex2i(w,h-40);
		glVertex2i(w,h);
		glVertex2i(0,h);
		glEnd();
		glColor4f(1.0,1.0,0.0,0.75);
		glBegin(GL_QUADS);
		glVertex2i(0,0);
		glVertex2i(w,0);
		glVertex2i(w,h-40);
		glVertex2i(0,h-40);
		glEnd();
		glColor4f(0.0,0.0,0.0,1.0);
		glRasterPos2f(10,h-32);
		glutBitmapString(GLUT_BITMAP_HELVETICA_18,text);
		glPopMatrix();
		GlutWindow::glDraw();
	}
}
Example #11
0
/****************Function to render characters****************/
static void renderChar(int x, int y, char *string) {

    //int len = (int) strlen(string);

    glRasterPos2f(x, y);

    if (windW <= 500)
        font = GLUT_BITMAP_TIMES_ROMAN_10;
    else if (windW <= 1000)
        font = GLUT_BITMAP_HELVETICA_12;
    else if (windW <= 1200)
        font = GLUT_BITMAP_HELVETICA_18;
    else
        font = GLUT_BITMAP_TIMES_ROMAN_24;

    if (zoom < 0.6)
        font = GLUT_BITMAP_TIMES_ROMAN_10;
    else if (zoom < 0.8)
        font = GLUT_BITMAP_HELVETICA_12;

    //for (; i < len; i++) {
    //	glutBitmapCharacter(font, string[i]);
    //}
    glutBitmapString(font, string);

}
Example #12
0
void Quadtree::draw(bool DRAW_CONTAINED_ITEM_ID)
{
	drawRectBounds(bounds, red);

	if (rectObjects.size() > 0)//(objects.size() > 0)
	{
		glColor3f(red.x, red.y, red.z);
		for (int i = 0; i < rectObjects.size(); i++)//objects.size();
		{
			glm::vec3 v1 = calcRelativePoints2D(bounds.sx, bounds.sy, screenW, screenH);
			glRasterPos2f(v1.x, v1.y - 0.07f - (i * 0.07f));
			glutBitmapString(GLUT_BITMAP_HELVETICA_18, rectObjects.at(i)->id_c);//objects.at(i)->id_c

		}

	}

	if (nodes != nullptr)
	{
		for (int i = 0; i < numOfNodes; i++)
		{
			if (nodes[i] != nullptr)
			{
				nodes[i]->draw(true);
			}
		}
	}
}
Example #13
0
void drawDebugInfo(void) {

    if (debugInfo == true) {

        glPushMatrix();
        glLoadIdentity();

        glMatrixMode(GL_PROJECTION);
        glPushMatrix();
        glLoadIdentity();
        gluOrtho2D(0, SCREEN_X, 0, SCREEN_Y);

        ss.str("");
        ss << "line start : " << linex1 << ", " << liney1 << std::endl;
        ss << "line end : " << linex2 << ", " << liney2 << std::endl;


        debugString = ss.str();
        glColor3f(1.0f, 0.0f, 0.0f);
        glRasterPos2f(20.0f, SCREEN_Y - 20.0f);

        glutBitmapString(GLUT_BITMAP_HELVETICA_12, (const unsigned char*) debugString.c_str());
        glPopMatrix();
        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
    }

}
Example #14
0
void PlanetLocator::render(int window_w, int window_h)
{
	if (m_hidden) return;

	glColor3f(1.0f, 1.0f, 1.0f);
	float rectw = (5.0f / (float)window_w);
	float recth = (5.0f / (float)window_h);

	TeleportTarget *target = game->getSpaceship()->getNavigator()->getTarget();
	std::string selected = getSelected();

	for (auto label : m_labels)
	{
		// Highlight targeted label
		if (target && target->getTeleportName() == label.first)
			glColor3f(0.0f, 1.0f, 0.0f);
		else if (selected == label.first)
			glColor3f(1.0f, 0.0f, 0.0f);
		else
			glColor3f(1.0f, 1.0f, 1.0f);

		// Highlight the label closest to the cursor

		glRectf(label.second.x - rectw, label.second.y + recth,
			label.second.x + rectw, label.second.y - recth);

		glRasterPos2f(label.second.x + 3 * rectw, label.second.y - recth);
		glutBitmapString(GLUT_BITMAP_HELVETICA_12, (unsigned char *)label.first.c_str());
	}
}
Example #15
0
void display_cb ( void )
{
  char string [ 80 ] ;

  glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;

  glColor3d ( 1.0, 1.0, 1.0 ) ;  /* White */
  /* Draw some axes */
  glBegin ( GL_LINES ) ;
  glVertex3d ( 0.0, 0.0, 0.0 ) ;
  glVertex3d ( 2.0, 0.0, 0.0 ) ;
  glVertex3d ( 0.0, 0.0, 0.0 ) ;
  glVertex3d ( 0.0, 1.0, 0.0 ) ;
  glVertex3d ( 0.0, 0.0, 0.0 ) ;
  glVertex3d ( 0.0, 0.0, 1.0 ) ;
  glEnd () ;

  glColor3d ( 1.0, 0.0, 0.0 ) ;  /* Red */
  draw_curve ( array_index, red_position ) ;

  glColor3d ( 0.0, 1.0, 0.0 ) ;  /* Green */
  draw_curve ( array_index, grn_position ) ;

  /* Print the distance between the two points */
  glColor3d ( 1.0, 1.0, 1.0 ) ;  /* White */
  sprintf ( string, "Distance: %10.6f", distance ) ;
  glRasterPos2i ( 10, 10 ) ;
  glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)string ) ;

  glutSwapBuffers();
}
Example #16
0
void View::draw_fps()
{
  //calculate FPS
  double frame_time_sum = 0;
  for(int i = 0; i < FPS_FRAME_SIZE; i++)
    frame_time_sum += rendering_frames[i];

  //prepare text
  unsigned char buffer[128];
  sprintf((char*)buffer, "avg. frame: %.1f ms", (float)(frame_time_sum / FPS_FRAME_SIZE));

  //prepare environment
  void* font = GLUT_BITMAP_HELVETICA_10;
  int width_px = glutBitmapLength(font, buffer);
  int height_px = glutBitmapHeight(font);
  int edge_thickness = 2;
  set_ortho_projection(false);

  //render background
  glEnable(GL_BLEND);
  glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
  glBegin(GL_QUADS);
  glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
  glVertex2i(output_width - (width_px + 2*edge_thickness), 0);
  glVertex2i(output_width, 0);
  glVertex2i(output_width, height_px + 2*edge_thickness);
  glVertex2i(output_width - (width_px + 2*edge_thickness), height_px + 2*edge_thickness);
  glEnd();

  //render text
  glDisable(GL_BLEND);
  glColor3f(1.0f, 0.0f, 0.0f);
  glRasterPos2i(output_width - (width_px + edge_thickness), edge_thickness + height_px);
  glutBitmapString(font, buffer);
}
Example #17
0
/*!
    Does printf()-like work using freeglut/OpenGLUT
    glutBitmapString().  Uses a fixed font.  Prints
    at the indicated row/column position.

    Limitation: Cannot address pixels.
    Limitation: Renders in screen coords, not model coords.

    \note Uses a fixed, 256-byte array for holding strings.
          The best way around this would be to use vasprintf(),
          but that is not available on WIN32, I believe.
          Another alternative would be to write our own formatter
          from scratch and emit the characters one at a time to
          the GLUT bitmap single-character drawing routine.
          We could also use vsnprintf(), but I'm not sure if
          that is standard...
*/
static void shapesPrintf (int row, int col, const char *fmt, ...)
{
    static char buf[256];
    int viewport[4];
    void *font = GLUT_BITMAP_9_BY_15;
    va_list args;

    va_start(args, fmt);
    (void) vsprintf (buf, fmt, args);
    va_end(args);

    glGetIntegerv(GL_VIEWPORT,viewport);

    glPushMatrix();
    glLoadIdentity();

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();

        glOrtho(0,viewport[2],0,viewport[3],-1,1);

        glRasterPos2i(
              glutBitmapWidth(font, ' ') * col,
            - glutBitmapHeight(font) * (row+2) + viewport[3]
        );
        glutBitmapString (font, (unsigned char *) buf);

    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
}
Example #18
0
void Redisplay(void)
{
    int win = glutGetWindow();
    int viewport[4];

    if (win==nWindow)
    {
        glClearColor(.2f,0.f,0.f,0.f);
        glColor3f(1,1,1);
    }
    else
    {
        /* child window */
        glClearColor(.0f,.2f,0.f,0.f);
        glColor3f(.5,.5,.5);
        glutPostWindowRedisplay(nWindow);
    }
    glClear(GL_COLOR_BUFFER_BIT);
    DrawQuad();

    if (win==nWindow)
    {
        glColor3f(1, 1, 0);
        glGetIntegerv(GL_VIEWPORT, viewport);
        glRasterPos2i(2, -glutBitmapHeight(GLUT_BITMAP_9_BY_15)+3+viewport[3]);
        glutBitmapString(GLUT_BITMAP_9_BY_15, (unsigned char*)"press f/r/m/d/c/i/h/p");
    }

    glutSwapBuffers();
    glutPostWindowRedisplay(win);
}
Example #19
0
void debugDisplay() {
	/*
	// Position
	char coords[100];
	sprintf(coords, "x: %.2f\ny: %.2f\nz: %.2f\n", g_camera.m_position.x, g_camera.m_position.y - 2.0, g_camera.m_position.z - 10.0);
	glRasterPos2f(-0.97f, 0.90f);
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) coords);

	// Velocity
	char v[100];
	vec3 vel = g_vessel->getVelocity();
	sprintf(v, "V.x: %.2f\nV.y: %.2f\nV.z: %.2f\n", vel.x, vel.y, vel.z);
	glRasterPos2f(-0.97f, 0.650f);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) v);

	// Acceleration
	char a[100];
	vec3 accel = g_vessel->getAcceleration();
	sprintf(a, "A.x: %.3f\nA.y: %.3f\nA.z: %.3f\n", accel.x, accel.y, accel.z);
	glRasterPos2f(-0.97f, 0.40f);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) a);

	char fps[30];
	sprintf(fps, "FPS: %.2f", g_FPS);
	glRasterPos2f(0.82f, 0.90f);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) fps);
	*/

	char hud[100];
	sprintf(hud, "Health: %i \t   Score: %d", g_vessel->m_health, g_score);
	glRasterPos2f(-1.2, 0.0);
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*) hud);
}
Example #20
0
/*-----------------------------------------------------------------------------
 *  DrawText
 *  Draws a set of text using the GLUT bitmap String for a location at x and
 *  y for a set font and buf
 *-----------------------------------------------------------------------------*/
void DrawText( float x, float y, void* font, char* buf) 
{
    /* Set the position */
    glRasterPos3f(x, y, 0.1);

    /* Print the text */
    glutBitmapString(font, buf);
}
Example #21
0
void outputString(std::string output, double x, double y, bool window)
{
	if (window)
		glWindowPos2i(x, y);
	else
		glRasterPos2d(x, y);
	glutBitmapString(GLUT_BITMAP_9_BY_15,(const unsigned char *)output.c_str());
}
Example #22
0
 void DrawString(const Position & p, const std::string & text, const GLfloat * rgba) 
 {
     glPushMatrix();
         glColor4fv(rgba);
         glRasterPos2i(p.x(), p.y());
         glutBitmapString(GLUT_BITMAP_HELVETICA_10, (const unsigned char*)text.c_str());
     glPopMatrix();
 }
Example #23
0
File: cgii.c Project: chamun/CGII
void
drawEnd(void)
{
    glPushMatrix();
    glTranslatef(WINDOW_SIZE/2 - 50, WINDOW_SIZE/2 - 50, 0);

    drawTransparentBoard(0, 0, SCORE_BOARD_WIDTH, 40);

    /* Text */
    glColor3f(0.0f, 0.0f, 0.0f);
    glRasterPos2f(30, 20);
    glutBitmapString(GLUT_BITMAP_HELVETICA_18, "You won!");
    glRasterPos2f(1, 35);
    glutBitmapString(GLUT_BITMAP_HELVETICA_12, "Press 'r' to restart");
    drawScoreBoard(0, 40);
    glPopMatrix();
}
Example #24
0
/**************************************************************************//**
* @author Paul Blasi, Caitlin Taggart
*
* @par Description:
* The display callback. Draws each of the objects and displays score for each
* player. If the game is currently paused, it also draws a translucent box
* over the play area and the text "Paused".
*
*****************************************************************************/
void Display(void) 
{
	int length;
	
	glClear(GL_COLOR_BUFFER_BIT);
    
    BALL.Draw();
    LEFT_PLAYER.Draw();
    RIGHT_PLAYER.Draw();
    LEFT_WALL.Draw();
    RIGHT_WALL.Draw();
    TOP_WALL.Draw();
    BOTTOM_WALL.Draw();
    NET.Draw();

	string right_score = to_string(RIGHT_PLAYER.Score);
	string left_score = to_string(LEFT_PLAYER.Score);


	glColor4fv(WHITE);

	length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)left_score.c_str());
	glRasterPos2i(50 - (200.0 / SCREEN_WIDTH * length / 2.0), 90);
	glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)left_score.c_str());

	length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)right_score.c_str());
	glRasterPos2i(150 - (200.0 / SCREEN_WIDTH * length / 2.0), 90);
	glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)right_score.c_str());

    if (PAUSED)
    {
		float alphaBlack[4] = { 0.0, 0.0, 0.0, .60 };
		Paddle temp;
		temp = Paddle(Point(100, 50), 200, 100, alphaBlack);
		temp.Draw();

		glColor4fv(WHITE);
		length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)"PAUSED");
		glRasterPos2i(100 - (200.0/SCREEN_WIDTH * length / 2.0), 50);
		glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)"PAUSED");
    }	

    //glFlush();
    glutSwapBuffers();
}
Example #25
0
/* Display 12 point Helvetica font to screen with custom rgb color */
void Text::textToScreenMedium(float x, float y, unsigned char* text, float r, float g, float b)
{
	if (r <= 1.0f && g <= 1.0f && b <= 1.0f)
		glColor4f(r, g, b, 1.0f);
	else
		glColor4f(this->r, this->g, this->b, 1.0f);
	glRasterPos2i(x, y);
	glutBitmapString(GLUT_BITMAP_HELVETICA_12, text);
}
Example #26
0
// (x, y) = center of text
void Game::renderText(float x, float y, const std::string& text, float r, float g, float b)
{
    void* font = GLUT_BITMAP_HELVETICA_18;

    glColor3f(r, g, b);
    glRasterPos2f(x - (glutBitmapLength(font, (const unsigned char*) text.c_str())) / 2.f, y + glutBitmapHeight(font) / 2.f);

    glutBitmapString(font, (const unsigned char*) text.c_str());
}
Example #27
0
Sun::Sun(const char* caption, int x, int y, float radiusRelative) : 
  Celestial(caption, x, y, radiusRelative)
{
  glColor3fv(COLOR);
  draw();

  glRasterPos2i(x, y);
  glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)caption);
}
Example #28
0
/* Display 18 point white Helvetica font to screen */
void Text::textToScreenLarge(float x, float y, unsigned char* text)
{
	// Draw text at screen coordinates (x, y), where (0, 0) is the top-left of the
	// screen in an 18-point Helvetica font
	glColor3d(this->r, this->g, this->b);
	glRasterPos2f(x, y);
	glutBitmapString(GLUT_BITMAP_HELVETICA_18, text);
	
}
Example #29
0
void RenderString(double x, double y, void *font, const char* string, RGB rgb)
{  
  char *c;

  glColor3f(rgb.r, rgb.g, rgb.b); 
  glRasterPos2f(x, y);

  glutBitmapString(font, (const unsigned char*)string);
}
Example #30
0
	void GlutApplication::display_text(const char * text, int x, int y)
	{
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluOrtho2D(0, m_width, m_height, 0);

		glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		glRasterPos3f(float(x), float(y), 0.0f);
		glutBitmapString(GLUT_BITMAP_9_BY_15, (const unsigned char*)text);
	}