-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide typed OpenGL objects rather than raw uint32s #125
Conversation
I suspect it's going to be quite difficult to get the confidence that making a breaking change as significant as this is going to be worth it at this point. Furthermore, such a decision invites further questions: "if we're willing to break the API for this, what other breaking API changes should we consider?" Given how long go-gl/gl has been around in its current form, I suspect it might be better to consider its API v1-like and stable, and leave significant breaking API changes to be done at another import path. There already exist some alternative OpenGL APIs that try to be higher level and do use named types for OpenGL types like Buffer and Texture. For example, see golang.org/x/mobile/gl and github.com/goxjs/gl. Maybe it's better to use something like that instead if that is the API you want yourself? go-gl/gl itself tries to be as simple and low-overhead as possible. Thanks. Also CC @hajimehoshi. |
Regarding backwards compatibility, I would argue that since This is in contrast to more normal libraries that typically change the underlying implementation of a much smaller API, which lends itself more to the standard Go practice of backwards compatibility. With that in mind, I think a perpetually unstable v0 may actually be more appropriate for That said, after thinking about this some more, it is possible to ease the transition- how about just providing type aliases for now? type (
- Buffer uint32
+ Buffer = uint32
...
) This would give people time to update their code before changing it to a full type declaration (which would be a breaking change)
My own position is that (All this is to say that I personally would have preferred a breaking API change over the
Thanks for the pointers. From a cursory glance, they don't seem to involve code generation? I think the biggest appeal of |
I agree that we should not introduce breaking changes in go-gl/gl even though this is still in v0, as go-gl/gl is already widely used. I don't know how this organization manages stable branches and development branches, so I think we need more discussion. |
It looks to me that we never got around to using tags, most of the code was written before Go had integrated version management. Given that the code has been around for a long time without major changes, I'd call what we have currently v1, and if there is a compelling need to make breaking changes, call that v2. |
That sounds convincing enough. In that case, how about adding (unstable) Portability between the two would be provided on a best-effort basis (for example, type declarations in |
The OpenGL XML spec provides type annotations that we can use to create proper Go types, which allows the compiler to catch mistakes such as swapped or incorrect parameters:
The following sed script can be used to automatically rewrite some
gl.Gen*()
declarations:Click here to see a preview of what users of go-gl would need to do to port their code:
Click here to see a preview of the go-gl/gl diff (truncated for brevity):
Since this is a breaking change, feedback would be appreciated.