I'm pretty new to opengl but been using c++ for a while now. How can I display variables using this? I can display single characters by using

glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN,'0');

Why can I not use

int x = 0;
glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN,x);

Compiles but won't display anything.

Recommended Answers

All 2 Replies

Haven't used it for a while, but I think it takes the ascii value in int form.

if you wan't to use variable use a char variable

char print ='0';
for(print = '0'; print != '9'; print++)
  glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, print);

Also google the function, and you get a documentation, like this

Thank you! that worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.