system
1
Does anyone have any idea how to convert the below codes to take in integer instead???
GLvoid glPrint(char* text)
{
if(text == NULL)
{
return;
}
glPushAttrib(GL_LIST_BIT);
glListBase(base - 32);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
glPopAttrib();
}
thanks!!
I don’t know an easy way to change to code to print an integer but I do know an easy way to make a string from an integer…
#include <stdio.h>
char IntegerToPrint[10];
int Number = 10;
sprintf(IntegerToPrint,"%d",Number);
This function, sprintf, will print the integer, Number, into the char array, IntegerToPrint. Pass IntegerToPrint to your glPrint(char *) function.