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

Glad OpenGL extensions loader support for MSW and Linux #2020

Open
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@paulhoux
Copy link
Collaborator

commented Jul 23, 2018

This PR will replace glLoad with the GLAD extension loader, allowing us to add OpenGL v4.6 features to Cinder. glLoad has not been updated in a while, so we're looking for an alternative.

When the GLAD files are generated without additional extensions, Cinder users will be forced to create a RendererGl of the correct version like so: CINDER_APP( MyApp, RendererGl( RendererGl::Options().version( 4, 6 ) ) ) to use the desired features.

To prevent confusion, however, we should add commonly used extensions when generating the GLAD files. I've added a minimal set of extensions, enough to make Cinder work out of the box. Before accepting this PR, it would be smart to discuss what extra extensions we might need.

GLAD features a webservice that makes it extremely easy to update the source files. See glad/glad.h, which is the main header of the loader. At the top, you'll find the exact settings used to create the files. If we want to add additional extensions, use the provided information as a starting point for the webservice and generate a new header.

An alternative to GLAD is FlextGL, which requires Python to generate the files. It would allow us to automate the process, if we're Python savvy, that is. But I'd say that GLAD's webservice is a much easier alternative which does not require us to install any additional development software.

The Linux version has not been tested and probably needs a few fixes to work. However, I have included the required GLX files, so this should not be too hard.

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 23, 2018

As expected, the ANGLE target failed to build. I'll look into it later. Consider this PR a call for comments. Would love to hear your opinion.

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 23, 2018

Oh, by the way: a good strategy to figure out which extensions we'd like to add by default, is to generate a header for OpenGL v3.2 (which is the lowest version currently supported by Cinder), then compile and run all tests and samples. Missing functions will then cause a runtime error. Figure out which extension provides the function and add it to the list. The result will be a comprehensive list of all extensions we'd like to support.

I would still recommend to generate the header for OpenGL v4.6, so that users can always use the latest features by specifying version( 4, 6 ) when creating RendererGl.

@paulhoux paulhoux requested review from andrewfb and richardeakin Jul 23, 2018

@paulhoux paulhoux self-assigned this Jul 23, 2018

@vinjn

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

I assume glew will also be removed?

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 26, 2018

I have replaced GLEW with GLAD for OpenGL ES. Not sure if GLEW is used for anything else. If not, it can (and probably will) be removed as well.

Note that this branch may not become part of the official Cinder release. We're still discussing our options. But I welcome your input.

@vinjn

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

I like this change :)

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 3, 2018

I should probably remove some commits from this PR. After my current project is done, I'll revisit this PR. Hopefully by that time, the Travis build will be fixed as well.

@MikeGitb

This comment has been minimized.

Copy link
Contributor

commented Sep 3, 2018

Hopefully by that time, the Travis build will be fixed as well.

This should do it: #2027

(Just in case you haven't seen it)

paulhoux added some commits Jul 21, 2018

Switched to the GLAD OpenGL loader. See `glad.h` for the list of incl…
…uded extensions (very minimal).

To generate a header with additional extensions, visit http://glad.dav1d.de/ and use the information in the current header as a starting point.
Headers for WGL and GLX are included as well. This has been tested on Windows, but not yet on Linux. *The Linux version probably needs to include the GLX specific headers and source.*
Fixes for Linux. I was able to successfully build Cinder. The Fightin…
…gPixelFighting sample does not work yet.

@paulhoux paulhoux force-pushed the paulhoux:glad branch from cd18236 to 8e410ed Sep 4, 2018

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 4, 2018

I just rebased this PR on cinder/master, but I realize the Travis fix has not been merged to master yet, so this rebase is pretty pointless in itself. To the Cinder devs: would it be possible to merge Mike's fix? I'd do it myself, but a) I am notoriously bad in testing PR's before merging and b) I don't feel confident enough touching the Linux codebase.

@MikeGitb

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2018

If the is no response: My PR just adds one line to the dependency installation script and doesn't really "touch the code base".

You can probably just add the same line to your own PR and travis should be happy.

@PetrosKataras

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2018

Just a note, that a fix for this is also exists as part of #2007.

Update apt package lists on Linux.
See also: #1964, #2027 and others.
@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 5, 2018

OK, cool, Travis works again. The build fails for Mac OS X targets, because I went ahead and removed glLoad altogether. We should probably make the switch to GLAD on Mac OS X as well. If anyone could help me out with that in this PR, that would be awesome.

@richardeakin

This comment has been minimized.

Copy link
Collaborator

commented Dec 2, 2018

I've been a behind on this, though talked a bit with Paul a while back offline, and I just wanted to say that I do think we should use this as a jumping off point for switching to a newer / savvier gl loader.

To my mind, GLAD is seeming like the favorite because of its ease of configuration and popularity, however I still think we should take this opportunity to compare FlextGL generated sources, primarily to compare the code length of each. I did manage to get the FlextGL python stuff working a while back (there was some broken dependency for 64-bit), and I've been meaning to use this to at least compare generated output sources between the two. This is at the top of my todo list. I think if the generated code is similar in quality / length, we should go ahead and get the OS X stuff in there, then look to merge this.

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 17, 2018

Thanks, Rich, for your input and support. Do you think you could try to add the support for GLAD on Mac OS X? I could probably make it work, but I am still on non-Mojave OS X and I feel I don't have enough experience with XCode to know for certain that my changes would work.

@earjuice

This comment has been minimized.

Copy link

commented Mar 19, 2019

I have to say, I've been using Paul's GLAD reverse-z branch on Windows 10 for about a year now and I love it. Was kinda worried it wouldn't be integrated into the master branch so I'm glad(haha) I stumbled on this thread. I totally fully support the notion of merging this into the master branch. Full gl extension functionality has been a blessing! Cheers!

@richardeakin

This comment has been minimized.

Copy link
Collaborator

commented Apr 7, 2019

Well, I have to apologize if I've been holding this one up. I haven't been able to find the time to test FlextGL, and with the added benefit of not needing python to use GLAD (along with @paulhoux already doing all this work), I agree we should go this route.

We still however need to go about adding GLAD support on other platforms, specifically OS X and Linux. If anyone can help with this, the contribution is much appreciated. These days I'm not on OS X or linux much..

@paulhoux

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 8, 2019

I for my part can make sure this branch stays up to date with master, so that it will be easy to later merge the two. My access to Linux and MacOSX is limited if not non-existent. So any help in that department is appreciated. All GLAD files are there, they "only" need to be incorporated into the Cinder base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.