bitmapped text (nub question)

Hi im very new to openGL

I am having problems using bitmapped text, using GLUT. I thought the calls were something like this:

glBegin(GLUT_BITMAP_TIMES_ROMAN);
glutBitmapCharacter(TIMES_ROMAN, 65);
//where 65 is the character ‘A’
glEnd();

im really unsure as to what to put in glBegin, and im sure i have glutBitmapCharacter right. Sadly i dont have any books on OpenGL to refer to at the moment.

has anyone used this before?

:confused: :mad: :confused:

Google is your friend:
http://techpubs.sgi.com/library/tpl/cgi-…tmapCharacter.Z

Sending a link to the man page for glutbitmap is not exactly helpful relic. Anyone can find that and man pages miss the big picture (but you have a point in this case).

Don’t use glBegin glEnd for this, that’s for drawing other primitives, GLUT uses a library utility with other OpenGL code etc to draw characters, some of those calls will be illegal inside a begin-end pair. The glBegin call is totally bogus, you don’t call this with jibberish like a font name token.

Equally important, you must position the raster position prior to drawing your character, remembering that any specified position is transformed through the modelview & projection matrices and clipped.

None of this information is in the glutbitmap man page :slight_smile:

And yes Relic really has a point you really should read the man page or at the very least look at the header, surely your code didn’t compile without plenty of warnings if not outright errors, I don’t know where you get your ideas about function arguments from. Software is picky about the arguments and types and your use of the glut call with bogus arguments and your use of the glBegin call with bogus arguments is worrisome. You’ve got to be specific with your function arguments, don’t just type something that might pass for code if the API were as you hoped it to be.

I thought it was adequate, because the page has this example which shows how the above code should have looked like. :wink:

  
  Here is a routine that shows how	to  render  a  string  of
       ASCII text with glutBitmapCharacter:

	 void
	 output(int x, int y, char *string)
	 {
	   int len, i;

	   glRasterPos2f(x, y);
	   len = (int) strlen(string);
	   for (i = 0; i < len;	i++) {
	     glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, string[i]);
	   }
	 }

how can i just display a single letter? that page doesnt relaly help i just wanted a glimpse at a blurb of code

nevermind i figured it out on my own. Relics info was more than i was looking for, dorbie thanks thats all i needed to know.