GLUI is a GLUT-based C++ user interface library which provides controls such as buttons, checkboxes, radio buttons, and spinners to OpenGL applications. It is window-system independent, using GLUT or FreeGLUT.
I'm trying to create an object which is a
conglomeration of GLUI controls, including a couple
buttons.
In an initialize or constructor function i create and
setup all the controls, being given a pointer to a GLUI
object. The problem is the buttons on the widget. If
the user clicks one button, i want to get and store the
current selection in a listbox for later polling by the
user of my object; if they click the 'cancel' button, i
want the object to just clean all the GLUI objects and
itself that it created.
It doesn't seem possible to have a function pointer to
a C++ member function, unless the function is declared
static... in which case it won't have access to the
slots or member functions that I need it to. It seems
to me the only alternative is to have a loop of sorts
that does a continuous get_int_val or similar on the
buttons.
This is undesirable as its slow and kludgy, and it may
require the user to know more about my object (theyd
have to create the object, and create a loop in THEIR
to continuously poll on it) than they should.
Are there any recommendations on a way to do this? Is
there a planned API change to make this type of thing
more 'friendly' ?
By the way, this is a file-selection widget so it ties
in nicely to RFE
"[ 889921 ] File support". I will of course release it
for other GLUI users to use and hope to get feedback /
ideas for enhancement / etc.
Thanks.
reply 1
Or, as a more genreal purpose solution, the ability to provide
an additional void* associated with each callback function, so
we can typcast it and invoke the class member-function in
our own static handler.
https://sourceforge.net/p/glui/feature-requests/9/
initial report
I'm trying to create an object which is a conglomeration of GLUI controls, including a couple buttons.
In an initialize or constructor function i create and setup all the controls, being given a pointer to a GLUI object. The problem is the buttons on the widget. If the user clicks one button, i want to get and store the current selection in a listbox for later polling by the user of my object; if they click the 'cancel' button, i want the object to just clean all the GLUI objects and itself that it created.
It doesn't seem possible to have a function pointer to a C++ member function, unless the function is declared static... in which case it won't have access to the slots or member functions that I need it to. It seems to me the only alternative is to have a loop of sorts that does a continuous get_int_val or similar on the buttons. This is undesirable as its slow and kludgy, and it may require the user to know more about my object (theyd have to create the object, and create a loop in THEIR to continuously poll on it) than they should.
Are there any recommendations on a way to do this? Is there a planned API change to make this type of thing more 'friendly' ?
By the way, this is a file-selection widget so it ties in nicely to RFE "[ 889921 ] File support". I will of course release it for other GLUI users to use and hope to get feedback / ideas for enhancement / etc.
Thanks.
reply 1
Or, as a more genreal purpose solution, the ability to provide an additional void* associated with each callback function, so we can typcast it and invoke the class member-function in our own static handler.
maybe just have something like this: