Comments (9)
This is reasonable behaviour for machines that don't support all the functions from glcorearb.h
. Imagine compiling your application with all functions from OpenGL 4.6, but targeting OpenGL 3.3.
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.
from gl3w.
Well, the function will return NULL
if that was the initial question
from gl3w.
I'm afraid you misunderstand my question. I'm not asking what you are trying to answer.
from gl3w.
@MasterQ32: Thank you for your willingness to answer. I think a more relevant answer can be tendered from some others.
from gl3w.
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.
from gl3w.
So the functions listed in union GL3WProcs
or <GL/glcorearb.h>
are just all OpenGL functions in the standard, not the actual available (in opengl32.dll or from wglGetProcAddress as extensions) OpenGL functions provided by the platform on which I ran the python script to generate the gl3w.c. Right? So all gl3w does is to mark a function item -- if it is available in the platform on which the application is running, the item is the function pointer, otherwise the item is NULL. So a serious application using gl3w should check whether the OpenGL function to be used is NULL or not before calling it, just as parse_version
of gl3w.c checks glGetIntegerv:
static int parse_version(void)
{
if (!glGetIntegerv)
return GL3W_ERROR_INIT;
glGetIntegerv(GL_MAJOR_VERSION, &version.major);
glGetIntegerv(GL_MINOR_VERSION, &version.minor);
......
}
Am I right?
from gl3w.
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 gl3wIsSupported
. If a graphics driver claims it supports a given OpenGL version, but then does not give you the function pointers, that would be a serious bug in the driver. If you want to use anything defined as an OpenGL extension, or that comes from a spec version newer than what you requested, then you should definitely check for NULL before using it.
from gl3w.
@tombsar: Thank you very much for the clear remarks.
from gl3w.
Closing this. Please reopen if you have further questions.
from gl3w.
Related Issues (20)
- No S3TC/DXT compression enums HOT 3
- Phyton 2.7.3 error HOT 1
- glfw_test.c issue on Mac HOT 3
- cmake add_subdirectory error.
- Version of gl3w that generates complete stand-alone .h file HOT 3
- some errors when using gl3w , help!!! HOT 3
- How to use gl3w on windows? HOT 1
- Is gl3w available as a library by default in Ubuntu? HOT 5
- generated gl3w.h dependent on khrplatform.h HOT 2
- Make gl3wProcs thread-local in C11 version
- glCreateBuffers Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) HOT 2
- gl3w falsely reports OpenGL 3.3 is not supported HOT 3
- CMake doesn't work out of the box HOT 5
- Readme file does not mention the --ext flag. HOT 1
- OpenGL 4.6 but get GL3W_ERROR_OPENGL_VERSION HOT 2
- [build] certificate verify failed: unable to get local issuer certificate HOT 4
- Do you need to call gl3wInit for every context? HOT 1
- Gl3w generate a C file but is using C++ stl
- Releases/tags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gl3w.