Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: GLUT and FLTK

  1. #1

    GLUT and FLTK

    Whenever a glut or fltk program is run, a dos window pops up in the background. How can I supress the display of this dos window?

    Also, fltk can be used with glut. In that case, the glut window becomes a child of the fltk window. But if there is more than one glut window, the second window onwards appear as separate independent windows and not as fltk child windows. How do I make all of them child windows and position them at different positions in the fltk window?

    For a glut window, it is possible to change the function doing the drawing by calling glutDisplayFunc() with the name of the new function. But if the idle function is changed, the program crashes. Reason and solution?

    Thanx for any advice offered.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    east norwalk, ct, usa
    Posts
    184

    Re: GLUT and FLTK

    Whenever a glut or fltk program is run, a dos window pops up in the background. How can I supress the display of this dos window?

    Hmm... this is a weird one. I've never had a dos window pop up on Redhat 9. You mean, like, another xterm?

    Seriously though, although I can't help you with your problem, I'm curious: why use glut? I mean, I had a look at fltk2 a couple of nights ago, and it looks pretty straightforward. Why not just let fltk handle your window and drawing areas for you?

    Thanx for any advice offered.

    Advice?: Switch to GNU/Linux. That will definitely suppress the display of the dos window.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,070

    Re: GLUT and FLTK

    What operating system are you using?

    What compiler are you using?

    Some have an option, to surpress the console or DOS window.

    Now on Redhat when I run the program from the Compilers IDE, I get a console(dos) window. But if I just click on the program to run it, no console(dos) window opens.


    Originally posted by abhijeet_maharana:
    Whenever a glut or fltk program is run, a dos window pops up in the background. How can I supress the display of this dos window?

    Also, fltk can be used with glut. In that case, the glut window becomes a child of the fltk window. But if there is more than one glut window, the second window onwards appear as separate independent windows and not as fltk child windows. How do I make all of them child windows and position them at different positions in the fltk window?

    For a glut window, it is possible to change the function doing the drawing by calling glutDisplayFunc() with the name of the new function. But if the idle function is changed, the program crashes. Reason and solution?

    Thanx for any advice offered.

  4. #4
    Advanced Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: GLUT and FLTK

    Educated guess: Windows + MSVC?

    Create a Windows application, not a Console application (and change main() in your GLUT program to WinMain(), along with the changed argument list etc).

    If: Windows + MinGW32

    Add -mwindows to your command line (and keep main()).

    Just my $0.02

  5. #5

    Re: GLUT and FLTK

    I am using VC++ on Win 98 for development. The program that I am writing is supposed to run on WIN as well as on Linux. So I am using glut and fltk. Marcus256, I can’t use winmain for this situation. Thanx for the suggestion.

    The program does not open up a console on Linux, but under Windows, it does. I want to suppress this window. Fltk has damn good support for OpenGL – by itself and also through glut, but even fltk opens up a Dos window.

    I have come across several fltk programs that behave like windows applications – they don’t pop up a DOS window in the background. But I couldn’t get the source code for them.

  6. #6
    Advanced Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: GLUT and FLTK

    You can also select an alternate program entry point. Do the "Windows Application" thing, but keep main(), and in some setting (around project/linking) you can specify the entry point.

    It should be "mainCRTStartup". From the commandline I do this by typing (at the end of the command line):

    "/link /subsystem:windows /entry:mainCRTStartup"

    ...but I guess you are using the IDE, so you have to find the right menu/tab.

  7. #7

    Re: GLUT and FLTK

    My problem is partially solved.

    I made my project a Win32 Application and not a console application.
    Under Project->settings
    under the link tab
    Category : select 'output'
    Entry-point symbol : type 'main' (Thanx Marcus)

    The program runs without a pesky dos window in the background. No recoding is necessary. This works fine with glut but not with fltk. If I compile a program referencing the fltk library, I get errors in VC++.

    The test program: (Win32 App and with the 'main' entry-point)


    #pragma comment(lib,"fltkd.lib")

    #include<gl/glut.h>
    #include<fl/fl.h>
    #include<fl/fl_window.h>

    void display()
    {
    glutSwapBuffers();
    }

    int main(int argc,char **argv)
    {
    Fl_Window w(640,400+100,"FLTK Demo");
    //w.show();
    //w.begin();
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowPosition(100,100);
    glutCreateWindow("This is OpenGL");
    glutDisplayFunc(display);
    glutDisplayFunc(display);
    //w.end();
    return Fl::run();
    //glutMainLoop();
    return 0;
    }


    The errors :

    --------------------Configuration: fltkdnodos - Win32 Debug--------------------
    Compiling...
    main.cpp
    Linking...
    LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
    fltkd.lib(Fl_x.obj) : error LNK2001: unresolved external symbol _select@20
    fltkd.lib(Fl_x.obj) : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
    Debug/fltkdnodos.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    fltkdnodos.exe - 3 error(s), 1 warning(s)

    ---------------


    However, if I comment out all fltk references and use only glut, it runs fine. (using fl/glut.h throws the same error here since the library is fltk. So I am using gl/glut.h)

    Any suggestions for fixing this problem?

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: GLUT and FLTK

    About your console, if you still wanted to do it see http://www.opengl.org/discussion_boa...ML/011665.html

  9. #9

    Re: GLUT and FLTK

    Thanx a lot everyone. My problem is solved. The link that was posted answered all my queries.

    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •