PDA

View Full Version : NeHe Tutorial Question



jeremyp
04-25-2001, 05:15 PM
Hi, I'm using Win32 Api. I'm very green to OpenGL and kinda rusty on my C++. I'm sorry if this is a really stupid question. Tutorial 14 shows how to use outline fonts. I want to use the glPrint command to print a variable that holds a character. Something like this:

glPrint(name);

The thing is, it gives me this error:
cannot convert parameter 1 from 'char' to 'const char *'

If anyone knows what I'm doing wrong, please help.

-Jeremyp

ffish
04-25-2001, 06:06 PM
The problem is in the different parameter you're passing to the function. Obviously, the function is defined as: glPrint(const char *string); but you're trying to call the function like this: glPrint(char name); There's a fundamental difference between chars and char *s. You'll have to convert your variable's contents to a char * before passing it to glPrint();

This is actually a C/C++ question. I'd suggest you dig up an old textbook and look at the difference between the data types. Alternatively, you could overload the glPrint(); function for chars. I can't look at NeHe at the moment (restricted uni proxy) but I can maybe have a look at the tutorial later - shouldn't be hard to overload glPrint();

Hope that helps.