Subject: Re: C++, GLUT, and function pointers.
To: None <netbsd-help@netbsd.org>
From: Ingolf Steinbach <Ingolf.Steinbach@jena-optronik.de>
List: netbsd-help
Date: 09/11/2003 16:24:01
Richard Rauch wrote:
> So, if I understand the thread correctly, I can register this callback:
> 
>   extern "C" static void callback_fun(int button, int state, int x, int
>   y);
> 
> from my C++ class:
> 
>   glutMouseFunc (callback_fun);
> 
> ...and have callback_fun() call my class?

Yes, this should work (provided callback_fun matches the
signature expected by glutMouseFunc()). The only drawbacks
are
 - one additional level of function calls
 - you'd have to make the static member function public to
   access it from callback_fun()

Good luck

    Ingolf
-- 

Ingolf Steinbach                       Jena-Optronik GmbH
ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04