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

Update OpenGL loader to one generated by glad 0.1.36 #2332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

totalgee
Copy link
Contributor

  • in a later step, we should update to glad2.

- in a later step, we should update to glad2.
@totalgee
Copy link
Contributor Author

totalgee commented Jun 18, 2024

I was actually intending to get rid of this build warning, that has annoyed me for ages with MSVC:

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
1>(compiling source file '../../src/cinder/gl/wrapper.cpp')
1>C:\Users\holag\Documents\Work\Immersence\immr-root\cinder\include\glad\glad.h(518,1):
1>see previous definition of 'APIENTRY'

Unfortunately after going down the rabbit hole here of updating to the latest glad wrapper -- the last update was 071e776 in early 2020 -- I realized (too late) that what was needed was actually glad2 ...the latest version of glad (v1) doesn't fix the APIENTRY warning, so this PR isn't strictly necessary to accept (it doesn't hurt, but also doesn't add much new, except for a few more extensions ;-).

I spent some time trying to integrate the glad2-generated loader, but it has as slightly different API and I got a bit sidetracked trying to find a cross-platform Cinder-y way to get the "address loader" function, which needs to be passed to its initialization functions. Usually it's wglGetProcAddress() on Windows, or can be glfwGetProcAddress() on any platform where we know we're using GLFW. I wasn't sure what would be the most Cinder-friendly way to do it, especially in places like src/cinder/gl/EnvironmentCore.cpp, for example, where we don't know about the Windows DC, or whether we're using GLFW, WGL, GLX, etc. Any suggestions from other maintainers on a good way to do this would be appreciated, and then maybe I can finish the update to glad2 at some point!

Thanks.

@richardeakin
Copy link
Collaborator

Hey @totalgee thanks for working on updating the GL loader and sorry for being late to this game - I think most if not all of the non-crossplatform functions are resolved in Environment.h/cpp. Perhaps I can help figure out where best to resolve those handles like HWND and HDC that you need if you push a new WIP PR for glad2.

I do think it would be great to update to the latest loader as cinder will be using OpenGL as its fundamental graphics backend for some time to come still.

Cheers,
Rich

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

Successfully merging this pull request may close these issues.

2 participants