How to call glutInit() without parameters ?

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

add these linker options to get make main() your entry point (I’m assuming you’re using VC):

/SUBSYSTEM:WINDOWS
/ENTRY:mainCRTStartup

-Lev

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

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.

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.

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