How to use GLUT

Started by
8 comments, last by Shag 22 years, 1 month ago
OK - first of all forgive me ... Once too often I see questions about a problem with someone's code ... It normally starts something like this ... "I'm using GLUT, but I haven't got a clue what I'm talking about" Please ... DON'T USE GLUT. Before I get flamed ... please read this. OpenGL is a grapics language. It works over several platforms. This is a GOOD thing. GLUT also works across platforms. However, GLUT sucks. The reason? The reason is because GLUT hides all the main code from you! Sound obvious? Well - it should do. Part of programming is that any individual has to learn about the platform(s) they are targeting. This is also a GOOD thing. By hiding such basic knowledge is not only BAD, but it's contrary to learning how to program. Let me give you an example ... I want to write Windows code. I haven't got a clue what I'm doing. So - under the pretense of learning openGL - I'll ask this forum how to do this, that and the other! NOW - most people in here (me included) are more than willing to answer most basic C/C++/VB/Delphi questions. However, when I recieve two emails the same evening, which went along the lines of "I have heard of OpenGL, so I want to make my own version of Quake3Arena, only better, how can I do this?" then you have to question the validity of any third person library. By hiding all the main code, it only discourages people from learning the basics! If you want to write efficient software, you need to understand the basics - like cache usage, basic binary maths, memory storage, CPU instructions ... etc. I really don't want to discourage people using openGL (or other graphics libraries) But to assume that because you've heard of OpenGL, doesn't mean that you are suddenly a programming guru ... PLEASE learn the basics first - for your own sake. Libraries such as GLUT and SDL are fine if you know what you are doing. But to jump into them without learning the basics first is actually a backwards step. There are so many web sites around which teach you the basics, it isn't true. Learn stuff off them, then try learning OpenGL. It's such a worthwhile thing to do it's unbeleivable. Imagine understanding basic computer operations before jumping into the deep end. WHAT you ask. It'll take you two days to do so (about 6 hours or so) and then you really have an understanding about programming. OpenGL isn't the simple answer to all your problems - It's a very steep learning curve. Especially when you start to look at extensions. By all means post questions here about such topics - you'll probably get a really useful answer. But things like how do I make Quake3Arena better - but I have no programming experience - really doesn't do you justice. Some people in here will break there backs trying to answer your question (even if they do sound simple). But please don't mail me asking how to make Quake3Arena better. Carmack has being programming for many years, that's why he is so good - there is no easy fix to this. OK - now you can flame me Regards Edited by - ShiningKnight on February 26, 2002 12:31:40 PM
Advertisement
I''m afraid you''ve made a fool of yourself. You see, GLUT is open-source. You can download it and even modify the code slightly if you wish. So if you had bothered to find out more about GLUT, you might have known...

-----------------------------
Direct3D vs. OpenGL
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Democracy is where you say what you want and do what you''re told.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
I know plenty about glut - that''s why I don''t use it ...
quote:Original post by Promit
I''m afraid you''ve made a fool of yourself. You see, GLUT is open-source. You can download it and even modify the code slightly if you wish. So if you had bothered to find out more about GLUT, you might have known...

Bingo.

quote:
DON''T USE GLUT


The problem is obviously not with GLUT. GLUT is so simple that if you can''t figure out how to use it, you have no business trying to use OpenGL.

GLUT is a good tool for beginners or anyone who needs cross platform support and can live within the constraints of the GLUT implementation (or modify the code). I had a class where I needed the project to run on Solaris, but I wanted to program at home in Windows and Linux -- it would have been very painful to do without GLUT.
quote:
Part of programming is that any individual has to learn about the platform(s)


I had niether the time nor the inclination to learn Solaris programming in 1 week. The whole point of having something like glut is that you can write code without worrying about where its running. The same program compiled and ran flawlessly under linux, windows, and solaris. I assume it would work on any other platform with a GLUT implementation. True its not for programming quake 3, but it has its uses. Choose a tool that is appropriate to your task.
GLUT is nice in that it lets you concentrate on the important parts of your game in the beginning. What''s more important, having perfect keyboard handling right off the bat, or having drawing code that works?

Once you get the drawing code up & running, you can put it into a platform dependent framework.

I find it so much easier to throw up prototype opengl stuff in glut though.
You wanna do some quick test? Glut is super easy.
Who cares about getting a pixel format descriptor and a window class and all that crap when you can''t even draw a triangle?
As usual, it''s horses for courses. GLUT is fine when you want to concentrate on getting the job done, rather than worrying about mastering the platform. The same can be said of VB, MFC etc.
I think what Shag is getting at is people, with little or no programming experience, using these libraries to help them get started, possibly getting some impressive, if simple results, and then having unrealistic expectations about what they can actually achieve (or worse believing they are King Shit of Turd Hill,) without learning more about the underlying platform and API''s.
As with all these things sooner or later you need to, or want to, step out of the environment they provide, and thats when a sound knowledge of what goes on under the covers really counts.

Add my $0.02 to the pot.


Slightly shrimpy smell == unsafe breadbin
Slightly shrimpy smell == unsafe breadbin
This argument sounds like me to a T :-), apart from i know i cant ''program quake3 but better''.....

I have had no previus knowledge of open_gl or how it works but i have used libraries such as GLUT to help me achieve some pretty impressive results with ease. (impressinve for me anyway)

So what, if im not learning programming the propper way, im enjoying doing what im doing, and that is the main thing...whats the harm in it.

I dont think there really is a backwards step once you have started. Take this scenario...

1/I start learning ''the propper way'' with how everything works
2/I dont see many results to keep me interested.
3/I get bored and give it up

For me doing it ''the propper way'', i will not learn, perhaps for others they will.

Lee
As usual there are no absolutes in life or as the old saying goes there is more than one way to skin a cat.

But don''t discount everything this fellow says despite that glut is a great tool and a great way to start learning graphics. He is right there are no substitutes for the basics. I use a lot of high level libraries as well and am constantly frustrated with bugs that I do not understand because I don''t understand the way the libraries function. Understanding the framework on which opengl is built could help a lot.

But let''s be realistic:

The reason people like me never learn the basics is because there is no good resources out there for learning the stuff.
Cash management and binary math...how many decent searches will you come up with on google with key words like that. Not many believe me I''ve tried. Perhaps we can pointlessly spend our money on books that cost 50-100$ a pop and half the time only end up with half the info we need to get the job done. further more whoever has the knowledge to write these texts are so damn brilliant that you can''t even understand what they are talking about.

Everything starts at a higher level because people want results and they want them fast.

Screw being thorough, this is America baby: land of fast-tracks and easy riches.

So is he right? I tend to agree, but what other choice do we have even if we do want to understand the ins and outs of the platform. Until someone can give me a good way to procure the basics for graphics programming I’ll stick to GLUT.

out
my number of glut programs written in the last week
3 (latest yesterday not finished yet)
ny number of programs written in win32 in the last year
2

http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement