PDA

View Full Version : Raster Graphics



03-29-2001, 07:59 PM
Hello,

As I had read through the Raster Graphics chapter in my book, I'd got a little bit angry about the length and complexity of the source code for loading a simple bitmap or displaying fonts.
I skipped the chapter. However, I know that one day I certainly will need Raster Graphics, mainly when putting out Text in my scene.
Is there a library function ( maybe glut or glu) which provides really simple functions for putting out texts? I don't want to write tons of code, just to write a simple "Hello" character string.

Paladin

ScottManDeath
03-30-2001, 12:31 PM
Originally posted by PaladinP:
Hello,

As I had read through the Raster Graphics chapter in my book, I'd got a little bit angry about the length and complexity of the source code for loading a simple bitmap or displaying fonts.
I skipped the chapter. However, I know that one day I certainly will need Raster Graphics, mainly when putting out Text in my scene.
Is there a library function ( maybe glut or glu) which provides really simple functions for putting out texts? I don't want to write tons of code, just to write a simple "Hello" character string.

Paladin

Well,
if you are using glut try this:

void Print3D(GLfloat x, GLfloat y, GLfloat z,char *format,...)
{
int len, i;
char printBuffer[1024];
va_list list;

va_start(list, format);
vsprintf(printBuffer, format, list);

glRasterPos3f(x, y,z);
len = (int) strlen(printBuffer);
for (i = 0; i < len; i++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, printBuffer[i]);
}
}

instead of using GLU_BITMAP_HELVETICA_12 you can look in glut.h to get other bitmap fonts like GLUT_BITMAP_ROMAN 12