GLUT Tutorial
GLUT stands for OpenGL Utility Toolkit. Mark J. Kilgard implemented it to enable the construction of OpenGL applications that are truly window system independent. Thanks to GLUT, we can write applications without having to learn about X windows or Microsoft’s own window system. Kilgard implemented the version for X windows, and later Nate Robins ported it to Microsoft Windows. Thanks to both, you did a great job.
With GLUT you can open a window for OpenGL rendering with 5 lines of code! Another 3 or 4 lines and you can a keyboard and mouse with your application. GLUT really makes things simple, hence it is very usefull to learn and to build small applications. Although GLUT is not being maintained anymore it still serves its purpose.
The GLUT distribution comes with lots and lots of examples so after you read through the basics in here you’ll have plenty of material to go on. Check out the GLUTs page.
In this tutorial I’ll introduce you to the basics of building an application using GLUT. This tutorial won’t introduce fancy visual effects in order to keep the code as simple as possible. I’ll use OpenGL 2.0 since it is much simpler and avoids complicating the core subject of the tutorial: GLUT.
There are open source versions of GLUT, such as freeGLUT and OpenGLUT. They all kept the API so 99.9% of what will be presented in this tutorial is still valid. Nonetheless these new versions do have some extensions that make it worth a try. Check out the extensions in freeGLUT here.
Please do comment if something is not completely clear. Your feedback is important.
Index
Basics
Input
- Keyboard
- Moving the Camera I
- Advanced Keyboard
- Moving the Camera II
- The Code So Far
- Mouse
- Moving the Camera III
- The Code So Far II
Pop-up Menus
Fonts
Extras
Subwindows
Avoiding the Idle Func
need simple source code for 3d tank in projection and keyboard function, please help me
plz give glut plane description of all function
Can you do a tutorial on texturing?
lighthouse3d is terrific. There’s often all the appropriate info at the suggestions of my fingers. Thank you and maintain up the superior work!
Hello there, The second sentence in the second paragraph is not clear. . . “Another 3 or 4 lines and you can a keyboard and mouse with your application.”
I want to create buttons in a OpenGL window, i,e, in a window some buttons will appear like START GAME, SCORE, EXIT etc.
And whenever we click on that button respective event should be triggered. But the program should be written using GLUT library only..
please anybody help me…
Hi there, Thank you very much for taking the time to write this. Cheers, it’s big help. thanks again.
YEAH VERY HELPFULL!
Wonderful write-up.
it’s really help
You will get a lot of views if you show how to setup OPENGL/GLUT WITH CODEBLOCKS.
I am also searching for this. Thanks.
I’ll keep it in mind, who knows… 🙂
I too would love to know how to set GLUT up with codeblocks. I’ve found loads on vc++ but thats all.
http://wiki.codeblocks.org/index.php?title=Using_FreeGlut_with_Code::Blocks
Nice tutorial.. Very easy to understand 🙂 hope you can add chapters like converting this to a game XD like shooting the snowmen
Great style. I would love to write that way.