PDA

View Full Version : How works glutMainLoop ?



Cristi
05-14-2017, 06:25 AM
Hey guys,

Sorry for my question but i am new with OpenGl and i don't understand how glutMainLoop works.
Let's say i have an init function that look like this :

glutInit(argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutInitWindowSize(default_width, default_height);
glutCreateWindow("Test");
glutDisplayFunc(show_results);
glutReshapeFunc(update);
glutIdleFunc(idle);

That means glutMainLoop will call show_results,update and idle over and over without stop?
Thanks :)

OceanJeff40
05-14-2017, 10:07 AM
I just did a few Googles on these functions, and that looks correct, as long as your update() function takes width and height as parameters, yes.

What kind of a project are you working on? I'm going for a simple 2D game and/or 2D artist graphics demo, maybe a very simple 3D thing too.

I have a YouTube channel where I've posted quite a few beginning tutorials on OpenGL, so here's my shameless plug below:

https://www.youtube.com/channel/UCzx8alrxVELz5h1dfCdkdfg

Thanks,

Jeff

OceanJeff40
05-14-2017, 10:09 AM
Just as a reference, here are the links that I used to find out info about those function calls:

https://www.opengl.org/resources/libraries/glut/spec3/node48.html

https://www.opengl.org/resources/libraries/glut/spec3/node63.html

Hope that helps also,

Jeff

Cristi
05-14-2017, 10:17 AM
Thank you for your help.
Very nice doc.