Sign in to follow this  

outputChracter

This topic is 3409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this