• Welcome to Computer Association of SIUE - Forums.
 

Getting rid of the console window in glut apps

Started by Victor Cardona, 2002-08-30T15:23:04-05:00 (Friday)

Previous topic - Next topic

Victor Cardona

If you are working with the glut library on Windows, and you want to get rid of the console window that is spawned along with your application, then here is how you can do it.

Step 1: Include windows.h before including anything else.

Step 2: Use the WinMain function instead of main.

Step 3: In the linker/system settings for your project, change the SUBSYSTEM option from "console" to "window".

Step 4: Recompile and enjoy.

Note: Some additional steps may be required when using Visual C++ 6. If so, check the
OpenGL website for more information.

Jim Sodam

Actually in VC++ 6 if you set up your project as a Win32 app instead of console and then go into project settings and change a few things you should be ok (ok as in no console window).

Go to the link tab, select output from the combo box and in the entry point symbol textbox put 'mainCRTStartup'

Not having that windows.h include will also help keep your code portable, not that it's a big deal to remove though.

Victor Cardona

Does it complain at all if you use the standard main function? With Visual C++ .NET I was forced to use WinMain instead of main(). Also, you must include windows.h on VC++ .NET or the glut libraries won't link properly. Glut redifines the c standard library's exit function.

Stiffler

My brother did some OpenGL programing for windows, and he didn't use GLUT at all. There's another library that you can add in that's more MS friendly, because he said GLUT compiled programs ran slowly. I forget what the Library is. I'll get in touch with my bro. Unless, someone knows what I'm talking about, but since when did ppl understand what I say? hehe

Jon
Retired webmaster of CAOS.

Jim Sodam

I have it working fine with just main(), but this is VC++ 6 not .NET.

And no you don't need to use GLUT, you can handle all the windows stuff yourself, or SDL is another option to keep things portable but it's not as easy to use as GLUT (certainly easier than writing platform specific code for every OS you want to release for though).

GLUT is generally considered, from what I've read, just something good to get a basic framework down quickly, not something you would want to use in a commercial game/app.

Victor Cardona

My previous instructions will work, but these instructions will allow you to use main instead of WinMain.

Step 1: Create your project as a Win32 Project.

Step 2: Make sure that you set Visual C++ to create an empty windows application using the settings wizard that appears.

Step 3: Include windows.h before anything else.

Step 4: In the Linker/Advanced settings screen, set the entry point to mainCRTStartup.

Now you should be able to program as you normally would using the glut library. As always, you can check out the OpenGL Website for more information.