I'm sorry if this is a re-post. I had a thread on this topic open as I spent this evening trying to, apparently, make OpenGL do something OpenGL really doesn't want to do. When I pressed the "Submit New Thread" button the page hung, so it might pop up eventually.

I like to use parameters with callbacks, like Windows dialog procedures. It allows the calling program to affect the callback's behavior.

If you're not familiar with the concept these parameters are pointer sized, 32 or 64 bit, values that might be something as simple as binary, or a pointer into an instance of a class the callback can then access.

I don't see any obvious means to pass parameters into OpenGL keyboard, mouse or scroll wheel callbacks.

I try to avoid passing global parameters, a practice the sample code in this (https://learnopengl.com/#!Lighting/Basic-Lighting) series of GREAT tutorials depends on.

Has anybody come up with a way to pass a parameter to one of these callbacks?

Thanks
Larry

Cornix

01-27-2017, 03:22 AM

OpenGL doesnt have anything to do with keyboard, mouse or other devices. OpenGL is a standard for outputting graphics only. What you are probably using is some kind of framework that handles the windowing, context creation and input. That is not OpenGL.

If this is the sort of thing you're looking for, the entire project and source code are available for download on my website (http://virtuallyprogramming.com/OGL45/OGL45.html) as BaseEngine.Zip, which would allow you to see it in context. I'm no expert on this, but I did get the callbacks working.