PDA

View Full Version : glut update game on idle or draw



cookedbird
01-11-2013, 12:56 PM
What is the better way to update my game. Update it before I draw during glutDrawFunc, or update it during glutIdleFunc?

Alfonse Reinheart
01-11-2013, 01:30 PM
Neither. You shouldn't be using GLUT of any kind to make a game. GLFW is far better for that task.

cookedbird
01-11-2013, 02:05 PM
Hmm, never hear of it, how is it better?

Nowhere-01
01-12-2013, 12:45 AM
Hmm, never hear of it, how is it better?

well using glut, while you making progress, you will notice that it requires some parts of your application to be centered around it. it is quite awkward, it may limit you and it is not suitable for real projects. it has more educational purpose, it is handy to build quick demo. and as far as i'm aware, it still uses a lot of deprecated functionality. it uses immediate mode to draw primitives, which is very inefficient and also not supported in modern opengl. GLFW is a tool which is designed to make context creation easy, also it has some input functionality, extension handling et c. basically, it handles all the OS-dependent stuff decently. but it doesn't interfere rendering and project's structure. and it's not outdated.

and for updating the game logics\physics\animation you should have a separate thread. rendering thread should be as independent as possible.