Help end child hunger

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

Pop-up Menus

Fonts

Extras

Subwindows

Avoiding the Idle Func

Source Code and Projects

  16 Responses to “GLUT Tutorial”

  1. need simple source code for 3d tank in projection and keyboard function, please help me

  2. plz give glut plane description of all function

  3. Can you do a tutorial on texturing?

  4. lighthouse3d is terrific. There’s often all the appropriate info at the suggestions of my fingers. Thank you and maintain up the superior work!

  5. 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.”

  6. 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…

  7. Hi there, Thank you very much for taking the time to write this. Cheers, it’s big help. thanks again.

  8. YEAH VERY HELPFULL!

  9. Wonderful write-up.

  10. it’s really help

  11. You will get a lot of views if you show how to setup OPENGL/GLUT WITH CODEBLOCKS.
    I am also searching for this. Thanks.

  12. Nice tutorial.. Very easy to understand 🙂 hope you can add chapters like converting this to a game XD like shooting the snowmen

  13. Great style. I would love to write that way.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: