Results 1 to 2 of 2

Thread: glutKeyboardFunc

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2001
    Posts
    17

    glutKeyboardFunc

    Does anyone know a page, or know where some sample code is that I can learn more about the keyboard function. I can't seem to get it to work and I am going on what I remember...so it's not going very well. Thanks.

  2. #2
    Member Contributor
    Join Date
    Jul 2001
    Location
    Camarillo, CA, USA
    Posts
    58

    Re: glutKeyboardFunc

    Don't worry, I'm an oGL newbie, so this is probably wrong..yay~!

    The glutKeyboardFunc's argument is a function, like processKeys... Check out this sample code, and see if you learn by example:

    void processKeys(unsigned char key, int x, int y) {

    switch(key){
    case 27: exit(0); break;
    case GLUT_KEY_LEFT: angle-=2.1; break;
    case GLUT_KEY_RIGHT: angle+=2.1; break;
    }
    }

    void main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(320,320);
    glutCreateWindow("Hello World!");
    glutKeyboardFunc(processKeys);
    glutMainLoop();
    }
    PROGRAMMERS SHALL RULE THE WORLD

Similar Threads

  1. glutKeyboardFunc problem
    By donmitz in forum OpenGL: General
    Replies: 0
    Last Post: 12-27-2012, 01:56 PM
  2. glutKeyboardFunc problem
    By donmitz in forum OpenGL: General
    Replies: 0
    Last Post: 12-26-2012, 06:30 AM
  3. using glutKeyboardFunc
    By Bobby253 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-06-2010, 08:24 PM
  4. glutkeyboardfunc(); bug???
    By LostInTheWoods in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-13-2003, 10:49 AM
  5. new glutKeyboardFunc( )?
    By NewtonApple in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-28-2001, 09:47 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