GLut or bare GL?

Started by
5 comments, last by RichardS 18 years, 7 months ago
I have quite a simple question: is there any speed difference as in rendering time, between using Glut or bare OpenGL. i mean, glut is obviously easier to learn, and although i know X quite well, i was unable to google some good tutorials about using GL&X. glut would save me of the trouble, so if there's no performance difference, i'd rather use it. Please answer and forgive me if i made any mistakes, as i am quite new to opengl. i googled for about 15min, but all i get is vague answers.
Advertisement
There should not be any speed differences per se if you use an OpenGL wrapper, but do keep in mind that with GLUT, the nature of it might not be that useful for what you are doing. Since GLUT revolves around callbacks, it is not really meant for Game programming. The overall structure of it can make any large program a nightmare. I'd say go with another library, such as GLFW or even perhaps using OpenGL with SDL before GLUT. But that's just my take [wink]
You can't just use 'bare GL' since without some other library, you have no way to create a context. GLUT is just one cross-platform way to do that. For any projects that a new OpenGL user will be working on, GLUT should have no performance impact at all. The simplicity is well worth it over any other lib.
um ok, thanks guys. well, it's just that i've heard myths about glut lagging is all. thanks, you've just saved me a lot of lines of code. oh and RichardS, i am not sure i understand? could you please make that clearer for me, as i have said, i am new to opengl. so you're saying basicaly that opengl is a set of standards, and that libraries like glut are implementation of those?
Quote:Original post by amenzix
um ok, thanks guys. well, it's just that i've heard myths about glut lagging is all. thanks, you've just saved me a lot of lines of code. oh and RichardS, i am not sure i understand? could you please make that clearer for me, as i have said, i am new to opengl. so you're saying basicaly that opengl is a set of standards, and that libraries like glut are implementation of those?


Well, you've got part of it right. OpenGL is a standard, yes, and drivers from the IHVs (eg. nVidia, ATI, 3DLabs, etc) contain implementations of OpenGL.

GLUT, however, is a cross-platform library for opening a window and rendering context for use by any OpenGL calls.
glut is no slower than whatever windowing code u could write thus will spend months of extra time to code up something as good as glut.
glut though hasnt been updated in years u will prolly be better served with sdl
Ok, to clear up the difference:

Before you can use OpenGL to draw anything (or to draw using any other system), you need to somehow create a surface to draw on. That may be a a full screen view (like most games), that may be one widget in a window, it doesn't matter. How to create that surface though varies widely on different platforms (and is very closely tied to the OS), so OpenGL didn't even attempt to standardize it.

GLUT is a cross-platform way of doing that. It's trivially easy to use, and works well, as long as you don't try to do something it wasn't designed for (not likely, in your case).

Once your context is created, GLUT (or SDL, or anything else), basically has no effect. You call glSomething(), and the call goes straight to OpenGL, regardless of how that context (read: drawing surface) was created.

As someone first learning OpenGL, you're the exact person that GLUT was designed for, and it'll serve you fairly well. Once you actually need to move beyond it, you'll find the jump to something more powerful fairly easy. I suggest against starting with something else like SDL, just because there is a lot more available help for GLUT out there, it's practically foolproof. That way, you're fighting only OpenGL, and not OpenGL+something else :)

This topic is closed to new replies.

Advertisement