PDA

View Full Version : How to call glutInit() without parameters ?



Andru
07-04-2002, 04:25 AM
Hello,

How do I call glutInit without any parameters ?

I know the syntax, it should get the argc and argv from main() ... but I'm using Win32 and there is no main(), only the usual WinMain stuff...

Someone please tell me what parameters to give glutInit ?

something like glutInit(1, NULL); or...?

Thanks in advance,

// Andru

Lev
07-04-2002, 05:54 AM
add these linker options to get make main() your entry point (I'm assuming you're using VC):

/SUBSYSTEM:WINDOWS
/ENTRY:mainCRTStartup

-Lev

Andru
07-04-2002, 12:24 PM
add these linker options to get make main() your entry point (I'm assuming you're using VC):
/SUBSYSTEM:WINDOWS
/ENTRY:mainCRTStartup

-Lev

Thanks, Lev...

But the answer is not that simple - I'm developing an independent class that uses GLUT and I wouldn't like to pass the (empty) argc and argv stuff all the way to the instance that calls glutInit() with empty parameters.

Any idea on how to pass glutInit() "empty" parameters, i.e. like just executing an .exe without any command line parameters ?

Thanks,

// Andru

chicho
07-04-2002, 11:37 PM
Hi, you can create your own parameters.
i.e.

char *myargv [1];
int myargc=1;
myargv [0]=strdup ("Myappname");
glutInit(&myargc, myargv);

also, you can omit the glutInit command. I try it and works good.

Bob
07-05-2002, 12:55 AM
Don't you think there's a reason GLUT have an init function? Just because it works in one or two cases doesn't mean it always works.

I suggest you pass "fake" arguments instead of completely omitting the glutInit call. At least you give GLUT the chance to initialize itself properly.

Andru
07-05-2002, 07:38 AM
chicho:

thanks, thats just what I needed.

I also omitted the glutInit() call and it seemed to work fine - but as Bob pointed out, the glutInit() just *might* exist for a reason, so I'd rather use it than forget it.

Thanks guys,

// Andru