Results 1 to 3 of 3

Thread: Passing parameter to glutKeyboardFunc

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    Ireland
    Posts
    19

    Passing parameter to glutKeyboardFunc

    Hi all,
    I have a bit of a problem. I what to pass an extra parameter to glutKeyboardFunc.
    Showing the code will make it easier to explain:

    glutKeyboardFunc(myKeyboard);

    void myKeyboard(unsigned char thekey, int x,int y){
    array_of_bool[thekey]=true;
    }

    The problem is that I cant find any way of passing array_of_bool to myKeyboard.

    I cant declare array_of_bool as a global .

    Any suggestions on how to pass array_of_bool to the function???

    Thanks in advance.

    [This message has been edited by TolTol (edited 12-12-2002).]

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Passing parameter to glutKeyboardFunc

    Why can't you make it global? What are you trying to do? There may be other ways to solve your problem than passing it via the function, which is, by the way, not possible.

  3. #3
    Senior Member Regular Contributor
    Join Date
    May 2002
    Location
    York, UK
    Posts
    128

    Re: Passing parameter to glutKeyboardFunc

    If you can't make it global, then other than a different solution to what you are trying to do ... the answer is NO, unless ...

    You edit your GLUT source code and ADD an extra arg to the glutKeyBoardFunc() !!!

    Or, perhaps more elegant, add a void* pointer to the end of the window structure, so you can point this to your own data structure which will be carried around on a per window basis ...

    Oh the need to do SOMETHING with glut ...

    Rob.

Similar Threads

  1. Replies: 3
    Last Post: 01-30-2013, 03:34 AM
  2. Passing cubemap as a parameter for my fragment shader
    By dzaharia1 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-18-2012, 06:13 AM
  3. silly ARB parameter passing question
    By vmh5 in forum OpenGL: GLSL
    Replies: 2
    Last Post: 01-28-2004, 06:21 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