glut and other newbie stuff.

I’m pretty new to programming in opengl, I’ve been learning mainly from the red book.

should I or should I not be using glut? I’ve heard it’s better to just learn to do things without it as it is slow and offers little customization. however, I’ve yet to find a good example on how to set up a window or set it fullscreen using a console application without glut.

any help would be appreciated.

GLUT is wonderfull because it lets you test your opengl without messing up with the windows system.

I’ve never heard a complain about it being slow, altough by definition it must be slower. Nevertheless any application can benefit rfom using GLUT in the early stages. If you’re really looking for developing openGL apps, my advice would be to start with GLUT and when everything is working as it should remove GLUT and implement the windows code. If you separate the rendering from the windows commands then this should be pretty straight forward.


Glut is nice because it is portable across many systems.
I also don’t think it is any slower(or faster) than other options (such as MFCs, etc). (At least I havn’t run across any real preformance problems using it).

Hope this helps!

This is a newbie question, but I guess that’s what this forums for. Where do I get GLUT? If you could also tell in short terms how to connect it to the compiler (I use MS Dev. studio C++), I’d be most gratefull.

Regards Anders

Plz disregard my last post. I have gotten it to work now. If I’d realized sooner how easy it would be, I wouldn’t have posted in the first place. Well, I guess that’s what you get when you act before you think. Sorry for wasting your time.

Regards Anders

ok, another question about glut. is it neccesary to use glutMainLoop()? sounds like a wierd question, but when I use it, it seems difficult to do things other than the display stuff. theres glutIdleFunc(), but the glut documentation states that there shouldn’t be much code put into there, so where does your programs main non-display processing go? any way to input into the glutMainLoop() other than the predefined callbacks?


At a basic level,

you register your callback functions to do specific things within your programs.


glutMouseFunc() for button presses

glutKeyboardFunc() for keyboards


glutIdleFunc() is pretty much essential for animations and movement (you need your computer to redraw the frame if its not doing anything. You can process your data in there and then call glutPostRedisplay() to draw the screen)

As for the barest minimum (as far as I’m aware) glutDisplayFunc(); and glutMainLoop();
are absolutly essential. (and the other stuff like glutInit() etc).

Checking out the glut.h file is a good idea ocassionaly, you can often find some interesting functions…

Yes, glutMainLoop is essential. And yes, you’re processing should be called from whatever callback you did register in glutIdleFunction.


I forgot to mention in my previous reply that you can also have input using pop-up menus in glut.

Check out my glut tutorial at