PDA

View Full Version : Opening GLUT-Windows in Win32 without a console app window possible?



The_V|k|ng
03-15-2002, 05:48 AM
Heya guys!

I've been making quite a progress in programming OpenGL (In my opinion, at least... http://www.opengl.org/discussion_boards/ubb/smile.gif ), but there's one thing that annoys me: I'm using the Borland Bcc32 command line compiler and therefore every time I run my program, that stupid Console Window pops up. So is there any way to prevent this? I'd still like to use GLUT and not the wgl-implementation, so that should not be an option...
Thanx for any help!

The_V|k|ng

nexusone
03-15-2002, 07:54 AM
Humm.... Do you have everything set to make a 32 bit windows application vs. a console application?



Originally posted by The_V|k|ng:
Heya guys!

I've been making quite a progress in programming OpenGL (In my opinion, at least... http://www.opengl.org/discussion_boards/ubb/smile.gif ), but there's one thing that annoys me: I'm using the Borland Bcc32 command line compiler and therefore every time I run my program, that stupid Console Window pops up. So is there any way to prevent this? I'd still like to use GLUT and not the wgl-implementation, so that should not be an option...
Thanx for any help!

The_V|k|ng

nickels
03-15-2002, 10:46 AM
I'll bet if you open a dos window, cd to where your .exe is and type it at the command prompt you won't get the window.

Whenever you launch a console app (which a glut program is --it has main, not WinMain) from a gui(say explorer) you get a spurious console window.

The_V|k|ng
03-15-2002, 12:47 PM
The thing is, I do not want a console window in any way! And I'd still like to use GLUT in Win98. So how is this supposed to be done? Is it possible at all? If so, what changes have to be made to the "normal" GLUT programs?

The_V|k|ng

heiman
03-15-2002, 02:23 PM
I suspect that you are using GLUT examples as a basis for your own applications. These programs were designed to be executed from a console window on any OS. Windows will create a console window for any program that uses a main() function.

If you want to create a GLUT application that does not have a console window then you will need to replace the main() function with a WinMain() function. A console window will not be created if you use the WinMain function. I think that GLUT creates the message loops and registers the windows for you, so you just need to call the GLUT function in a WinMain routine to execute the app.

03-15-2002, 08:20 PM
Not sure if it is the same in Borland as it is in Visual C++ or not, but this is what I do in VC++ at the top of the file with my main() function in it:




#ifdef WIN32
// pragma to remove extra console window under windows
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
#endif

The_V|k|ng
03-16-2002, 12:22 AM
Heya again!

First of all, thanx for your replies!
Unfortunatley they did not affect much... The #pragma has no effect and replacing the main() by a WinMain produces the following linker error:

Turbo Incremental Link 3.0 Copyright (c) 1997, 1998 Borland International
Error: Unresolved external '_main' referenced from E:\BORLAND\BCC55\LIB\C0X32.OBJ

Not that I have any clue as to what that means... Does any of you? Can anyone help me with this?

The_V|k|ng