This topic is now archived and is closed to further replies.


glut or window.h

Recommended Posts

hi all, i am a newbie here, sorry if this question seem goes 1. In the opengl book, the window function are provided using the glut library. In the tutorials on the site, the window functions are done using the windows.h library. Is there any difference, eg performance, etc or any criteria to take note of when choosing either of the implementation thanks for the attention!

Share this post

Link to post
Share on other sites
When you use the windows.h thing like NeHe your programm runs not in DOS Console mode.

If you use the glut functions to create the window, you have a dos window running in the back.

Both works fine, your choice ....

Share this post

Link to post
Share on other sites
glut is a small, platform-independent library, meant for creating simple OpenGL apps. It does stuff for you like creating windows, going fullscreen, setting the display mode... All of this is really easy. It's great while you're learning OpenGL, because you can concentrate on the graphics programming itself. Of course, due to it's simplicity, it's fairly limiting and inflexible, you can't create buttons for example, and you miss most advanced features needed for larger projects.

The Win32 API gives you full access to the windows environment. You can do anything you want, the way you want. All of this comes at a price however, the API is extremely large, and will be confusing at first. Setting up an OpenGL window using the Win32 API can easily take 100+ lines, whereas you could do it in +-5 with glut. And of course, your code isn't portable.


about the console window:

If you're using VC++ you can easily get rid of it.

- create a Win32 application (instead of a console app)
- go to Project/Settings/Link
- in the Category combobox, select Output
- in the Entry-Point Symbol editbox, type 'mainCRTStartup'

this will let you use main() instead of WinMain()


At the top of your source file (in console or win32 app), add the following line:

#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")

pragma's are compiler specific, so you can only use this in VC++, but other compilers will probably have similar options...

btw: if I remember correctly, glut comes with a DLL, this DLL is normally not present on Windows systems, so if you want to use glut-programs on another computer, you need the DLL as well.

Edited by - kvh on January 11, 2002 6:19:15 AM

Share this post

Link to post
Share on other sites