what are GLUT's disadvantages?

Started by
12 comments, last by a2k 24 years ago
what''s bad about GLUT? i haven''t heard anything bad about glut, but i''m sure there are some bad things about it. i thought it was just a nice encapsulation of gl.h and glu.h. anyway, what''s up? a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
GLUT basically just a lot of system-dependent functionality. Things like window creation and mouse and keyboard input. So, obviously, all of your GLUT code is portable, just like your OpenGL code. Advantage. =)

The disadvantage to it is that, since those functions have to be platform-independent, their implementation isn''t quite as powerful or feature-rich as what you''d find in the operating system''s own API. Also, you can''t do things like setting the resolution (unless you have some special version of GLUT I''ve heard about)--in other words, making an app full-screen in GLUT means making its window take up the entire screen. Probably the biggest problem with GLUT is that it doesn''t seem to be a standard component so not only would you have to download it, but any of your end users would have to obtain it somehow, too. Annoying.

I''d recommend using GLUT for anything small and/or personal. Otherwise, do it the "real" way.
I second that!

If you absolutely, positively need platform idependence use GLUT. Use GLUT to experiement with, it helps keep things clear. When you''re ready to ''publish'' as it were, use win32 and wgl.

Paul Groves.
http://home.clara.net/paulyg
OpenGL for Beginners
Paul Grovespauls opengl page
thanks for making me understand it. actually, NeHe''s full screen example code is a good place to start, am i wrong? do you think this is a good start?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
I used to recommend GLUT, but it is currently in an unsupported state (as of GLUT3.7 beta) and it doesn''t look like it has any clear direction when it comes to adding any new features. Sure, whats there now is great, but it could use some work.

For people looking to GLUT for OS abstraction, I''d suggest they take a look at SDL (http://www.devolution.com/~slouken/SDL/) in addition to GLUT and see which meets their needs better right now, and which is more likely to grow where they''d want it to grow in the future.
Ahh, so that''s what SDL is! I''ve been out of the loop for a while and saw it mentioned in another thread...

Paul.
Paul Grovespauls opengl page
Biggest problem I found with GLUT was that there was no way to elegantly break out of the main loop, which is contained in the library itself. Your program basically runs until somebody hits the close box or you call exit() --in either case, anything allocated dynamically is screwed.

Thankfully, the source is included, and it''s an easy fix. Just write up a function that sets a global flag, and make sure that the main loop checks the flag as it goes.

(my byline from the Gamedev Collection series, which I co-edited) John Hattan has been working steadily in the casual game-space since the TRS-80 days and professionally since 1990. After seeing his small-format games turned down for what turned out to be Tandy's last PC release, he took them independent, eventually releasing them as several discount game-packs through a couple of publishers. The packs are actually still available on store-shelves, although you'll need a keen eye to find them nowadays. He continues to work in the casual game-space as an independent developer, largely working on games in Flash for his website, The Code Zone (www.thecodezone.com). His current scheme is to distribute his games virally on various web-portals and widget platforms. In addition, John writes weekly product reviews and blogs (over ten years old) for www.gamedev.net from his home office where he lives with his wife and daughter in their home in the woods near Lake Grapevine in Texas.

Hi everyone,

This is sort of related... does anyone know if you can get relative mouse coords from GLUT, or set the mouse coords? (I can't find a way, and I've been looking for ages)
Just curious.

The mouse thing above, and the main loop thing that johnhattan mentioned, are my main gripes about GLUT. Other than that, it's quite good for spanking together an OpenGL app (be it tool, simple game, whatever), and is very simple for beginners to learn (its what I used to learn, rather than aux).

PS: you can run GLUT in fullscreen, by calling glutFullscreen() (strangely enough...) after you create and initialise the window. A resize event will restore it to windowed mode again.

-------------
squirrels are a remarkable source of protein...

Edited by - Bad Monkey on 4/11/00 8:41:10 PM
oh, yeah.
thanks, bad monkey, but is it still unsuitable for game programming?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
I''m actually building a terrain engine at the moment built around GLUT... its just fine, except for the damn mouse... when you go to use mouselook, and you turn long enough in one direction, the mouse cursor position eventually hits the edge of the screen, and you stop turning (I base rotation on the difference in absolute position of the mouse, ''coz I can''t get relative values). Its a real bitch.

Basically, I can''t be bothered setting up a proper win32 app (I keep telling myself its better to have OS abstraction... what a load of bollocks. I''m just lazy ).

You can try and use it for games, but its probably better in the long run (i.e. when you want to make more advanced games) to use the native framework (win32, X, whatever).

-------------
squirrels are a remarkable source of protein...

This topic is closed to new replies.

Advertisement