-
Notifications
You must be signed in to change notification settings - Fork 156
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
What if the function is neither in opengl32.dll nor from wglGetProcAddress? #57
Comments
This is reasonable behaviour for machines that don't support all the functions from When starting the application on a system that does not support newer functions than those of OpenGL 3.3, the application should still run and not emit any errors or warnings regarding missing functions. |
I'm afraid you misunderstand my question. I'm not asking what you are trying to answer. |
Well, the function will return |
@MasterQ32: Thank you for your willingness to answer. I think a more relevant answer can be tendered from some others. |
If an OpenGL function is not found in either of those locations, then it is not present on the local machine. Returning NULL in these situations seems correct to me; it will raise a segfault only if you try to use this function, and otherwise continue normally. |
So the functions listed in
Am I right? |
Yes, that all sounds right to me. On Windows you can only find out what functionality is actually available at runtime, so not everything in the OpenGL headers will work. There is definitely an argument to be made that gl3w should check for failures, at least for core functionality, but I presume the author decided the extra safety wasn't worth the overhead or code complexity. If you want your code to be completely safe, you should check every OpenGL function pointer before use. In practice, however, you should be safe using any core OpenGL functionality for a given OpenGL version after checking |
@tombsar: Thank you very much for the clear remarks. |
Closing this. Please reopen if you have further questions. |
Take Windows as an example. The function pointers are retrieved in get_proc(). It first tries to retrieve a function pointer from wglGetProcAddress, assuming it is an extension. If not, it then find it in opengl32.dll using GetProcAddress. However, the return value of GetProcAddress is not checked, which seems to be assuming that the function must be in opengl32.dll. But on what is this assumption based? What if an OpenGL function is neither in opengl32.dll nor from wglGetProcAddress?
PS: the current code of get_proc():
The text was updated successfully, but these errors were encountered: