hi,everyone. i’m a beginner in opengl programming.
when i start to read the RED BOOK, it uses glut for demo and i works well. but i wonder why people won’t use glut for developing commercial applications such games, 3d software,etc. is there any difference between glut and opengl, such as glut can’t implementing some opengl functionality? or glut can’t use opengl shading languange?
hi, glut is a library that runs on top of opengl, it is mostly used to help teach opengl to beginners, it is not used on comercial applications because its very slow.
Except the speed factor and os denpdent things, are there any other function that glut can’t do ?
There are many things glut can’t do - it is after all only a high level library. When you make a call to a glut routine, it in turn makes the appropriate calls to opengl. The most useful part of glut (IMHO) is that it provides system independent windowing and also a few keyboard input features.
So, it’s good to learn on because you can focus on learning the opengl commands and the intracies of the 3d world without having to worry about windows or linux or whatever specific programming.
However, once you have learnt the basics, I would highly recommend moving away from glut and learn the specifics of the platform you are targetting. I myself have only been programming with OpenGL for a short while and found the transition from glut quite easy and profoundly rewarding in terms of power and flexibility.
To clarify some things:
The things that you can’t do with glut are not OpenGL related. You can still use the full OpenGL feature set with glut.
But glut lacks some features that belong to general application programming like timers. If you need them, you would have to use direct calls to operating system dependent functions, and it will be easier to just drop glut and do everything yourself…
But as long as you don’t need these things, glut is just fine. And AFAIK glut is not really slower than using the native windowing functions…
I haven’t seen any GLUT functions to set the resolution of the window(?). The keyboard function is not real time and it seems that it’s depend on the current defenitions of the windows keyboard.If you use from the keyboard function, you can see a interrupt at the first time that you push a key.
I suggest you to don’t waste your time to learn it.I have taught it for 2 years in my university and understood that this API isn’t useful for the projects of the university.I suggest you to study the lesson 1 of the NeHe lessons and use from the ACTUAL WINDOWS PROGRAMMING.
To me glfw is really great for easy cross-plateform OpenGL programming :
it has timer, threads, proper keyboard and mouse handling, basic texture loading, fullscreen and resolution support (with refresh rate on some plateforms).
And it is really easy to use.
Thank you all for giving me so much advice and suggestion ^^. i did read some NeHe tutorial and found that “normal” opengl init is so complicated and the glut is so concise . Moreover, the glut provide you a command line window for output error message or fps information,just like the quake/cs style command line, which i think is cool ^^.
Now, i decide to switch to “normal” opengl instead of glut. thank you all again.