sensics / OSVR-RenderManager

Apache License 2.0
64 stars 45 forks source link

Added new getDisplayFrameBuffer callback to OSVR_OpenGLToolkitFunctions #155

Closed JeroMiya closed 8 years ago

JeroMiya commented 8 years ago

Implements: https://github.com/sensics/OSVR-RenderManager/issues/154

JeroMiya commented 8 years ago

Thanks for updating the sample. For future reference, to design a C API like the OSVR_OpenGLToolkitFunctions, except that it doesn't break the API when you add new callbacks as this pull request does, you would make it an opaque type, and add "setter" C API functions to set those callbacks. That way you can add new callbacks without breaking the API, just by adding a new setter function. The drawback is that OSVR_OpenGLToolkitFunctions becomes a reference type, and you would then need a "destroy" function (similar to osvrClientShutdown).

russell-taylor commented 8 years ago

Good to know. This came in from a pull request, and I took it largely as it was.

How do you keep from seg faulting when an example doesn't set the function? I guess you need a creation function that sets them to sensible defaults.

Thanks, Russ

At 04:57 PM 7/26/2016, you wrote:

Thanks for updating the sample. For future reference, to design a C API like the OSVR_OpenGLToolkitFunctions, except that it doesn't break the API when you add new callbacks as this pull request does, you would make it an opaque type, and add "setter" C API functions to set those callbacks. That way you can add new callbacks without breaking the API, just by adding a new setter function. The drawback is that OSVR_OpenGLToolkitFunctions becomes a reference type, and you would then need a "destroy" function (similar to osvrClientShutdown).

­ You are receiving this because you are subscribed to this thread. Reply to this email directly, https://github.com/sensics/OSVR-RenderManager/pull/155#issuecomment-235402071view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AAuh0Fydywcn017u2fL6LVCUOjDrW3wuks5qZnSrgaJpZM4JUn1Qmute the thread.


Russell M. Taylor II, Ph.D. russ@reliasolve.com www.cs.unc.edu/~taylorr

JeroMiya commented 8 years ago

Just so. You have a creation/destruction pair of functions for the opaque type. The creation function sets the defaults (nullptr here).

russell-taylor commented 8 years ago

Or in this case a pointer to a function that fills in zero and returns true, so it won't seg-fault when the RenderManager code calls this function...

JeroMiya commented 8 years ago

The RenderManager code should still null check each function pointer. I think it does currently. The caller could "set" a function to nullptr.