Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: GLUT_DISABLE_ATEXIT_HACK and Dante's Inferno

  1. #1
    Intern Newbie
    Join Date
    May 2017
    Posts
    38

    GLUT_DISABLE_ATEXIT_HACK and Dante's Inferno

    So I'm getting worked over by the ATEXIT_HACK error below: I am trying to follow a tutorial I like where the only language seems to be glut.h. I am unable to get glut going. I have gotten freeglut no problem: should I switch to that?
    I've also made a glut_h file with the fix verified in it but no help. Here's my skeleton programbelow). Do I persevere at debugging this or swtch to what I know works, but will it really works (glut-->freeglut)

    Code cpp:
    #include <windows.h>  // For MS Windows
    #define GLUT_DISABLE_ATEXIT_HACK
    #include <glut.h>  // GLUT, includes glu.h and gl.h
     
        int WINDOW_WIDTH = 540;
        int WINDOW_HEIGHT = 540;
        int main(int argc, char** argv)
        {
        //initialize necessary GLUT things
                glutInit(&argc, argv);
                glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
                glutInitWindowPosition(100,100);
                glutInitWindowSize(320,320);
                glutCreateWindow("Lighthouse3D- GLUT Tutorial");
     
                return 1;
        }

    Code :
     C:\MinGW\include\GL\glut.h:58:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #  pragma comment (lib, "winmm.lib")      /* link with Windows MultiMedia lib */
     ^
    C:\MinGW\include\GL\glut.h:66:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "opengl32.lib")  /* link with Microsoft OpenGL lib */
     ^
    C:\MinGW\include\GL\glut.h:67:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "glu32.lib")     /* link with Microsoft OpenGL Utility lib */
     ^
    C:\MinGW\include\GL\glut.h:68:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "glut32.lib")    /* link with Win32 GLUT lib */
     ^
    C:\MinGW\include\GL\glut.h:76:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
     #  pragma warning (disable:4244)  /* Disable bogus VC++ 4.2 conversion warnings. */
     ^
    C:\MinGW\include\GL\glut.h:77:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
     #  pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */
     ^
    C:\MinGW\include\GL\glut.h:50:24: error: redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
     typedef unsigned short wchar_t;
                            ^
    In file included from <command-line>:0:0:
    C:\MinGW\include\GL\glut.h:531:21: warning: 'int glutCreateMenu_ATEXIT_HACK(void (__attribute__((__cdecl__)) *)(int))' defined but not used [-Wunused-function]
     static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
                         ^
    Last edited by Dark Photon; 06-21-2017 at 04:35 PM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by technologist View Post
    I am unable to get glut going. I have gotten freeglut no problem: should I switch to that?

    Survey says:
    * macro #define GLUT_DISABLE_ATEXIT_HACK
    * Using freeglut or GLUT with MinGW
    * MinGW (OpenGL Wiki)

    you may have an option, but consider flipping to freeglut.

  3. #3
    Intern Newbie
    Join Date
    May 2017
    Posts
    38
    Quote Originally Posted by Dark Photon View Post
    Survey says:
    * macro #define GLUT_DISABLE_ATEXIT_HACK
    * Using freeglut or GLUT with MinGW
    * MinGW (OpenGL Wiki)

    you may have an option, but consider flipping to freeglut.
    Just cannot get the macro to work. Seems like by internet results this works for many people. Buried iin the yellow pragma I do have a red error. When I look it up it hsoots me to UK/China.

    I am putting the macro before "glut.h".
    I've also tried a fixed h file no luck.
    Ive read the other options: I am good with freeglut, but I am very stubborn with letting this go in case I need pure glut

    Code :
    C:\bil_inc_lib\include\glut.h:58:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #  pragma comment (lib, "winmm.lib")      /* link with Windows MultiMedia lib */
     ^
    C:\bil_inc_lib\include\glut.h:66:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "opengl32.lib")  /* link with Microsoft OpenGL lib */
     ^
    C:\bil_inc_lib\include\glut.h:67:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "glu32.lib")     /* link with Microsoft OpenGL Utility lib */
     ^
    C:\bil_inc_lib\include\glut.h:68:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
     #   pragma comment (lib, "glut32.lib")    /* link with Win32 GLUT lib */
     ^
    C:\bil_inc_lib\include\glut.h:76:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
     #  pragma warning (disable:4244)  /* Disable bogus VC++ 4.2 conversion warnings. */
     ^
    C:\bil_inc_lib\include\glut.h:77:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
     #  pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */
     ^
    C:\bil_inc_lib\include\glut.h:50:24: error: redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
     typedef unsigned short wchar_t;
                            ^
    In file included from <command-line>:0:0:
    C:\bil_inc_lib\include\glut.h:468:22: warning: 'void glutInit_ATEXIT_HACK(int*, char**)' defined but not used [-Wunused-function]
     static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
                          ^
    C:\bil_inc_lib\include\glut.h:485:21: warning: 'int glutCreateWindow_ATEXIT_HACK(const char*)' defined but not used [-Wunused-function]
     static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
                         ^
    C:\bil_inc_lib\include\glut.h:531:21: warning: 'int glutCreateMenu_ATEXIT_HACK(void (__attribute__((__cdecl__)) *)(int))' defined but not used [-Wunused-function]
     static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
                         ^

    Maybe a more apropos question would be can I use freeGlut completely for a GLUT site. Will using freeGLUT impose restrictions for a site requiring GLUT? From what I understand freeGLUT umbrellas over GLUT. ??
    Last edited by Dark Photon; 06-22-2017 at 05:19 PM. Reason: not complete

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by technologist View Post
    ...I do have a red error. ...
    ...
    Code :
    C:\bil_inc_lib\include\glut.h:50:24: error: redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
     typedef unsigned short wchar_t;
                            ^
    ...
    A guess: Could be that the glut.h is incompatible with including <windows.h> first. Try getting rid of that, or moving <windows.h> after <glut.h>

    Maybe a more apropos question would be can I use freeGlut completely for a GLUT site. Will using freeGLUT impose restrictions for a site requiring GLUT? From what I understand freeGLUT umbrellas over GLUT. ??
    FreeGLUT is a free implementation of GLUT. It's a stand-alone GLUT implementation. So no, it doesn't umbrella over some other GLUT implementation. You can use it alone. For many folks, it's the only GLUT implementation they've ever used. So you should be able to just use FreeGLUT instead if you want.

  5. #5
    Intern Newbie
    Join Date
    May 2017
    Posts
    38
    Quote Originally Posted by Dark Photon View Post
    A guess: Could be that the glut.h is incompatible with including <windows.h> first. Try getting rid of that, or moving <windows.h> after <glut.h>



    FreeGLUT is a free implementation of GLUT. It's a stand-alone GLUT implementation. So no, it doesn't umbrella over some other GLUT implementation. You can use it alone. For many folks, it's the only GLUT implementation they've ever used. So you should be able to just use FreeGLUT instead if you want.
    But will it work with a GLUT site. I'll give it a shot.
    Last edited by technologist; 06-22-2017 at 08:03 PM. Reason: more info

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by technologist View Post
    But will it work with a GLUT site. I'll give it a shot.
    What do you mean by a "site". Web site?

    "GLUT" with "site" didn't make any sense to me, so I assumed you meant "GLUT app" and chalked it up to a possible English-as-second-language issue.

  7. #7
    Intern Newbie
    Join Date
    May 2017
    Posts
    38

    ESL not : )

    Quote Originally Posted by Dark Photon View Post
    What do you mean by a "site". Web site?

    "GLUT" with "site" didn't make any sense to me, so I assumed you meant "GLUT app" and chalked it up to a possible English-as-second-language issue.
    Sorry! I meant a tutorial site that bases all of its teaching points and examples on GLUT.

  8. #8
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Ah! That makes sense to me now :-)

  9. #9
    Intern Newbie
    Join Date
    May 2017
    Posts
    38
    Ok, got the GLUT all version done without the freeglut. Had to be done, even though will still go with freeglut.
    I set compiler settings to library:

    -lglu32
    -lglut32
    -lopengl32

    include settings to my includes library:

    "C:\bil_inc_lib\include"

    Now we have a skeleton Lighthouse initialization code all ready to go(below).

    BUT: this doesn't work, plz help
    As discussed want to store all .hs under one folder
    #include <GL/glut.h>
    here:
    #include <.../bin_inc_lib/includes/glut.h>, where includes are my includes

    Code cpp:
    #include <windows.h>  // for MS Windows
    #include <GL/glut.h>
    #include <iostream>
     
    void renderScene(void) {
     
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
        glBegin(GL_TRIANGLES);
            glVertex3f(-0.5,-0.5,0.0);
            glVertex3f(0.5,0.0,0.0);
            glVertex3f(0.0,0.5,0.0);
        glEnd();
     
            glutSwapBuffers();
    }
     
    int main(int argc, char **argv) {
     
        // init GLUT and create Window
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
        glutInitWindowPosition(100,100);
        glutInitWindowSize(320,320);
        glutCreateWindow("Lighthouse3D - GLUT ONLY Tutorial");
     
        // register callbacks
        glutDisplayFunc(renderScene);
     
        // enter GLUT event processing cycle
        glutMainLoop();
     
        return 1;
    }
    Last edited by Dark Photon; 06-25-2017 at 12:26 PM.

  10. #10
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by technologist View Post
    BUT: this doesn't work, plz help
    For folks to help you, you need to tell them more about the problem (e.g. what doesn't work, what triggered it, what the error is, and what you've done to try and resolve it).

    Works fine for me here on Linux, if I surround the windows.h include with #ifdef WIN32 ... #endif.

Posting Permissions

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