Results 1 to 3 of 3

Thread: Is there some kind of magic to make glutKeyboardFunc(...) work?

  1. #1

    Is there some kind of magic to make glutKeyboardFunc(...) work?

    This is under Win2000/MSVC/glut 3.7.

    I have a sub window, but the main window is receiving the keyboard callbacks.

    [This message has been edited by Nocturnal (edited 03-22-2001).]

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2001
    Location
    London UK
    Posts
    195

    Re: Is there some kind of magic to make glutKeyboardFunc(...) work?

    You need to set the callbacks for the subwindow like any other window. Here is a good tutorial http://www.fatech.com/tech/opengl/gl...ex.php3?subwin

  3. #3

    Re: Is there some kind of magic to make glutKeyboardFunc(...) work?

    Here is the constructor I use (functions beginning with S_ are static class functions; i.e. compatible with GLUT callbacks) [SEE BELOW LINE]

    As you can see, I call glutKeyboardFunc for my sub window. Also, I set keyboard callbacks for my main window which displays a message box with the key and the window id whenever it is called.

    My breakpoints for the sub window keyboard callback are never triggered. The sub window does receive its mouse callback sometimes but it does appear to be erratic.

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

    GlutWindow::GlutWindow(int x, int y, int width, int height)
    {
    id = glutCreateSubWindow(glutGetWindow(), x, y, width*10, height*10);
    mouse_over = false;
    wants_idle = false;
    glut_to_class[id] = this; // a static std::map
    glutDisplayFunc(S_Display);
    glutKeyboardFunc(S_KeyDown);
    glutMouseFunc(S_MouseButton);
    glutMotionFunc(S_MouseMove);
    glutEntryFunc(S_MouseOver);
    glutSpecialFunc(S_SpecialKey);
    glutShowWindow();
    }

Similar Threads

  1. persistent buffer mapping - what kind of magic is this?
    By st4ck0v3rfl0w in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-22-2014, 09:24 AM
  2. glGetStringi how make it work?
    By ewerton in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 01-06-2013, 02:33 PM
  3. HOW DO I MAKE OPENGL WORK<<<<
    By Andrewinator in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-24-2003, 01:49 PM
  4. I can' make it work on C++ Builder 1.0
    By Machiavelly in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-15-2001, 04:26 AM
  5. How to make Quake3 Work on ATI RAGE-IIC 8MB AGP?
    By Leon in forum OpenGL: User Software
    Replies: 1
    Last Post: 01-12-2001, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean