Results 1 to 2 of 2

Thread: glutKeyboardFunc problem

  1. #1
    Guest

    glutKeyboardFunc problem

    Hi,

    I am trying to use the glutKeyboardFunc function which takes the function myKeyboard as an argument, eg,

    glutKeyboardFunc(myKeyboard);

    myKeyboard has the parameter list: unsigned char thekey, int x, int y

    When I run the program I am getting an error:

    [C++ Error] GlSkel.cpp(11: E2034 Cannot convert 'void (* (_closure )(unsigned char,int,int))(unsigned char,int,int)' to 'void (*)(unsigned char,int,int)'.

    Any ideas as to what i'm doing wrong???

    Thanks.

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

    Re: glutKeyboardFunc problem

    Try cast the function pointer to the proper type.
    Code :
    glutKeyboardFunc(reinterpret_cast<void (*)(unsigned char,int,int)>(myKeyboard));

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. Problem with glutKeyboardFunc
    By Flow91 in forum OpenGL: Linux
    Replies: 1
    Last Post: 12-05-2012, 03:36 PM
  4. glutKeyboardFunc problem
    By 147147 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-28-2012, 02:29 AM
  5. problem with glutKeyboardFunc(keyboard);
    By Dathu in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 04-17-2008, 08:22 AM

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