Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glutinit arguments

Tags:

opengl

I am beginner at openGL. In all simple examples main function has arguments and glutinit func uses those. But I don't understand why they are necessary. I write nothing in command arguments and the programs still works. What are they used for? Can you give an example?

glutInit(&argc, argv)
like image 309
peaceman Avatar asked Jan 19 '13 02:01

peaceman


1 Answers

They're used so that GLUT can process command line arguments. It has a number of arguments that it always uses. If you don't want GLUT to process arguments, just pass something like this:

{
  int argc = 1;
  char *argv[1] = {(char*)"Something"};
  glutInit(&argc, argv);
}
like image 118
Nicol Bolas Avatar answered Sep 17 '22 22:09

Nicol Bolas