Sign in to follow this  
pkiskool

outputChracter

Recommended Posts

Hi, I'm trying to output a value which a variable is carrying. Here is how I'm trying to do it:
void *font = GLUT_BITMAP_9_BY_15;
char s[100];

void outputCharacter(float x, float y, float z, char *string) 
{
  int len, i;
  glRasterPos3f(x, y, z);
  len = (int) strlen(string);
  for (i = 0; i < len; i++) 
  {
    glutBitmapCharacter(font, string[i]);
  }
}

void RenderScene(void)
	{
	sprintf_s(s,"%d", disp);
outputCharacter(- ((gridspace * n)/2-(gridspace/2)) - 42, (gridspace * n)/2-(gridspace/2) - 9, 0, s);

				// Restore transformations
				glPopMatrix();

				// Flush drawing commands
				glutSwapBuffers();

				glutPostRedisplay();

	}

Obviously this is just bits and bits and you won't be able to compile it. The variable which carries the value that I want is called 'disp'. It is a big number (a pressure value up to 500,000 Pa). But it will just display a zero at the momment. I double checked to see that disp is carrying the correct value of 500 Kpa.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this