Open hajimehoshi opened 6 years ago
I have never used any of the *Debug*
functions in gl
, so I can't say.
Further reference: https://github.com/go-gl/glow/issues/3
It does look strange, but I believe can work. If you dig into it, you find that glowDebugMessageCallback
ignores its callback parameter.
I don't know why there is a callback parameter. One thought I had was that it could be to prevent garbage collection of the function value, but I guess that doesn't make sense because the function value is stored in userDebugCallback
.
@errcw could you shed light on the callback parameter? Could it be eliminated from
C.glowDebugMessageCallback`, or otherwise could we add a comment explaining its reason for existence?
If I remember correctly it's simply an artifact of the code generation, i.e., it just takes the C definition so ends up with an extraneous parameter that is dropped so the C/Go machinery works. It would be a reasonable enhancement to add a comment or, even better, remove the unused parameter entirely (though if it involves too much special casing I'd be wary).
For example, in the current
DebugMessageCallback
implementation, Go function's pointer is converted to a C pointer:I was wondering if this really works, and anyone tests this. I found https://github.com/go-gl/gl/issues/40 , and perhaps these functions don't work now?