PDA

View Full Version : glfw callback custom parameter



3DPrgmer
09-04-2016, 08:12 AM
Hi,

i think i'm gonna touch the advanced OpenGL programming now. Since my program become bigger and bigger, i started to organize it a bit. Therefore i have a controller class, that handles everything.
Problem: I set some callback functions. But these need to affect some things in my controller class. So my question, is there a way to pass some custom parameter to the callback functions??

GClements
09-04-2016, 08:39 AM
Problem: I set some callback functions. But these need to affect some things in my controller class. So my question, is there a way to pass some custom parameter to the callback functions??

Not as a function parameter, but glfwSetWindowUserPointer() and glfwGetWindowUserPointer() can be used to associate user data with each window.

3DPrgmer
09-06-2016, 07:45 AM
worked just fine. Thanks :D

jonhnack
09-15-2016, 02:46 AM
I experienced a couple OpenGL instructional exercises, did a heap of pursuits however can't locate a decent answer for my issue