View Full Version : Is there some kind of magic to make glutKeyboardFunc(...) work?
03-22-2001, 12:11 PM
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).]
03-22-2001, 06:34 PM
You need to set the callbacks for the subwindow like any other window. Here is a good tutorial http://www.fatech.com/tech/opengl/glut/index.php3?subwin
03-23-2001, 07:55 AM
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
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.