winapi - OpenGL how to determine the latest version to code with -
folowing this link in directx can add lines:
#include <d3d11.h> #include <d3dx11.h> #include <d3dx10.h> #pragma comment (lib, "d3d11.lib") #pragma comment (lib, "d3dx11.lib") #pragma comment (lib, "d3dx10.lib") ...
to specify 'up date' dx version want code in. how can achieved in opengl can sure using latest gl libraries while coding. should #define
or gl functions use in code determine version of opengl?
is there method in c++ or other software can tell version of opengl .exe program using?
that's not how opengl works; opengl not statically link (or rather, that's not all have do). have (generally speaking) dynamically load opengl functions work with. typically done employing opengl loading library of kind, reducing #including header , calling function during initialization (after creating opengl context).
the "version" of opengl use depends on version supported implementation , functions/enums choose use. if code written against opengl 3.3, implementation supports 4.1, that's fine; it's backwards compatible 3.3.
there ways ask opengl version of opengl being provided, runtime query, not compile-time construct. can explicitly request version (greater or equal ask for) @ context creation time, cause context creation fail if version not supported implementation.
this makes code bit more flexible. example, can write optional parts of program can provide more features if, example, opengl 4.1 available, default 3.3. won't have work 2 (somewhat) different apis, or build abstraction merges common elements. have conditional somewhere in code verifies 4.1 provided, , if is, call few other functions. otherwise, 3.3 stuff.
Comments
Post a Comment