Computer Association of SIUE - Forums

CAOS Forums => Technical Knowledge => Topic started by: Victor Cardona on 2002-08-30T15:23:04-05:00 (Friday)

Title: Getting rid of the console window in glut apps
Post by: Victor Cardona on 2002-08-30T15:23:04-05:00 (Friday)
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 (http://www.opengl.org) website for more information.
Title: Re:
Post by: Jim Sodam on 2002-08-31T18:45:54-05:00 (Saturday)
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.
Title: Re:
Post by: Victor Cardona on 2002-08-31T21:02:10-05:00 (Saturday)
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.
Title: Re:
Post by: Stiffler on 2002-08-31T21:11:01-05:00 (Saturday)
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
Title: Re:
Post by: Jim Sodam on 2002-08-31T22:31:06-05:00 (Saturday)
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.
Title: Re: Revised instructions
Post by: Victor Cardona on 2002-09-02T14:40:15-05:00 (Monday)
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 (http://www.opengl.org) Website for more information.