Skip to content
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

IGlHandleStruct #1552

Open
frederikja163 opened this issue Dec 16, 2022 · 6 comments
Open

IGlHandleStruct #1552

frederikja163 opened this issue Dec 16, 2022 · 6 comments

Comments

@frederikja163
Copy link
Member

Description

Add interface for all GlHandles
Makes it possible to take a generic GlHandle for methods like GL.ObjectLabel.

@NogginBops
Copy link
Member

Without generic implementations of those functions GL.ObjectLabel(identifier, IGLHandle name, int length, string label) would cause boxing, so the function should be

public void ObjectLabel<THandle>(identifier, THandle name, int length, string label) where THandle : IGLHandle

This would also have to work with the fact that by default typed handles are turned off.

@frederikja163
Copy link
Member Author

frederikja163 commented Dec 18, 2022

This would also have to work with the fact that by default typed handles are turned off.

Not sure what you mean about this.

But i didn't necessarily mean we should provide the overload for ObjectLabel. But in user code it would be possible to do stuff of that nature or similar. For example in my project using OpenTK 5, i have a base class for all GLObjects. public abstract class GLObjectBase<T> : IDisposeable But i would like to add a constraint to the template type. So it could only be a GL Handle.

@NogginBops
Copy link
Member

Ah I see! Yeah we can add a common interface to the different handles sure.

This would also have to work with the fact that by default typed handles are turned off.

Not sure what you mean about this.

In the next prerelease typed handles is going to be turned off. See #1545

@utkumaden
Copy link
Collaborator

utkumaden commented Dec 18, 2022

One issue is that as it stands the typed handles are enums. Enums cannot implement interfaces. A struct can however.

@NogginBops
Copy link
Member

One issue is that as it stands the typed handles are enums. Enums cannot implement interfaces. A struct can however.

They are not enums atm? They are structs.

@utkumaden
Copy link
Collaborator

I stand corrected, had to go back and verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants