-1

I am working on a flight simulator in opengl in which i have made and altitude scale with an arrow pointed towards the expected altitude values controlling the plane with joystick i want that when changing the altitude of plane with joystick movement altitude values should be displayed in front of the pointed arrow and should move upward and downward with increasing and decreasing altitudes. lets say altitude values should be displayed starting from 0 to never ending value. just to be clear i have a variable in which values are updating correctly when i cout them the problem is with text rendering.

i have tried using glutBitmapCharacter().

void text(float px,float py,int v)
{
    glRasterPos2f(px ,py);
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, v); 
}

and this is how i am calling

text(2.11,0-x[4]/200,48)

x[4] has altitude values

i want v to be generated depending upon x[4] values. say if x[4]= 200 then function should be called 3 times with v values 50,48,48

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982

1 Answers1

0

You probably want to use glutBitmapString to print multiple characters to the screen. You can use std::ostringstream or snprintf() to convert your number to a string.

(See: How do I use glutBitmapString() in C++ to draw text to the screen?)

Moeren
  • 169
  • 1
  • 6