PDA

View Full Version : glPrint



02-27-2002, 02:29 AM
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!!

Rob The Bloke
02-27-2002, 04:43 PM
sprintf

reubenhawkins
02-27-2002, 04:46 PM
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.