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

OpenGL support for other platforms #6

Open
SamoZ256 opened this issue Jul 6, 2023 · 4 comments
Open

OpenGL support for other platforms #6

SamoZ256 opened this issue Jul 6, 2023 · 4 comments

Comments

@SamoZ256
Copy link
Contributor

SamoZ256 commented Jul 6, 2023

At its current state, libwsi only support EGL for OpenGL context creation. The functions and files all feature EGL in its name, which makes it pretty much impossible to add another context creation API right now. Are there any future plans to change this?

@markbolhuis
Copy link
Owner

Yes and no. I have two (maybe 3) options for OpenGL support.

  1. Wrap EGL. WGL and CGL in my own API and provide a cross platform way to create contexts and such.
    This is the most obvious thing for first class OpenGL support for this library, but Is a lot of work.

  2. Do the bare minimum and just provide a means to get native platform handles from WsiPlatform and WsiWindow
    This is what I'm doing right now with EGL, but for CGL and WGL I'd need to add an equivalent wgl.h and cgl.h to include/wsi and then users can use that.

  3. Wrap WGL and CGL in EGL. This is ambitions but technically possible. It's actually similar to what Microsoft already did in Mesa.
    EGL is a Khronos API and is designed to be cross platform. Its used on LInux. BSDs, Android, and Windows when using ANGLE . It should really be the preferred method, but It was developed too late to become the de-facto standard on mac and windows.
    The would be a lot of work as well and I don't have the time for it.

Right now I've picked 2 because it was easy to do. I don't have a computer with macOS or Windows on it to test any cross platform API.

@SamoZ256
Copy link
Contributor Author

SamoZ256 commented Jul 6, 2023

I would go with the first option. MacOS uses something called NSOpenGL for context creation and it's pretty easy to integrate.

@SamoZ256
Copy link
Contributor Author

SamoZ256 commented Jul 6, 2023

After looking at the eglgears example once again, it seems that EGL and NSOpenGL have a lot in common, and creating a small translation layer shouldn't be that hard. At least to provide the basic functionality.

@SamoZ256
Copy link
Contributor Author

SamoZ256 commented Jul 7, 2023

I have done a bit of research and I have created a small translation layer to translate EGL to NSOpenGL https://github.com/SamoZ256/NSEGL. Might be useful in the future.

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

No branches or pull requests

2 participants