GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing cpp.libhunt.com — glbinding Alternatives - C++ Graphics | LibHunt glbindingA C++ binding for the OpenGL API, generated using the gl.xml specification.
Take the C++ Developer Survey
- About 6 minutes on the tools, libraries and AI you use with C++. You get the results by email.
Take the survey »
Popularity
5.0
Growing
Activity
4.3
Declining
Stars
882
Watchers
40
Forks
96
Last Commit
Description
See what's new in glbinding-2.0.0 and glbinding-2.1.1.
Programming language: C++
License: MIT License
Latest version: v3.1.0
glbinding alternatives and similar libraries
Based on the "Graphics" category.
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
Promo
www.saashub.com
* Code Quality Rankings and insights are calculated and provided by Lumnify.
Do you think we are missing an alternative of glbinding or a related project? READMEglbinding is a cross-platform C++ binding for the OpenGL API. glbinding leverages C++11 features like enum classes, lambdas, and variadic templates, instead of relying on macros; all OpenGL symbols are real functions and variables. It provides type-safe parameters, per-feature API headers, lazy function resolution, multi-context and multi-thread support, global and local function callbacks, meta information about the generated OpenGL binding and the OpenGL runtime, as well as tools and examples for quick-starting your projects. Based on the OpenGL API specification (gl.xml) glbinding is generated using python scripts and templates that can be easily adapted to fit custom needs.
Code that is written using a typical C binding for OpenGL, e.g., GLEW, is fully compatible for the use with glbinding and causes no significant impact on runtime performance (see compare example): just replace all includes to the former binding, replace the initialization code and use the appropriate API namespace, e.g.,
ResourcesInstallation and Development
Feature Documentation and Code Snippets
Install Instructionsglbinding is available for different platforms using different distribution channels. You can either download the source and manually compile it or use one of the pre-compiled releases of this repository. For systems providing package managers, we generally strive for packages in these package managers. WindowsThe various glbinding packages can be installed either by downloading an installer, e.g., the x64 installer for glbinding v3.1.0 for Microsoft Visual Studio 2015, or downloading and extracting one of the precompiled archives, e.g. runtime, examples, dev, and tools. Since lately, glbinding is also available on vcpkg with more recent releases:
Alternatively, download the source code and commence building from source. Ubuntuglbinding is provided on Ubuntu using PPAs and in Ubuntu universe since Artful Aardvark. We maintain our own PPA for most recent releases. For Ubuntu 16.04 (xenial), 17.10 (artful), and 18.04 (bionic) use the standard PPA, for Ubuntu 14.04 (trusty) use the backports PPA. Using the current PPA as example, the following lines install glbinding including the GLFW examples:
To use glbinding as dependency, install the development package:
Alternatively, download the source code and commence building from source. Arch LinuxOn Arch, glbinding is provided by the glbinding package in the community repository. To install glbinding execute the following line:
Alternatively, download the source code and commence building from source. macOSThe package manager on macOS we depend on is homebrew. The package there is called glbinding. To install glbinding using homebrew, execute the following line:
Alternatively, download the source code and commence building from source. Debian-based Systemsglbinding is available for Debian 9 (Stretch), 10 (Buster) and Sid. Install it using Cross-Platform Package ManagersAs one of the cross-platform package managers, conan provides glbinding in its center index. You can use the folling line to install glbinding using conan:
Build InstructionsPrerequisites and DependenciesThe only mandatory run-time dependencies of glbinding are the STL of the used compiler and an OpenGL driver library, dynamically linked with your application. Building glbinding from source has several mandatory and optional dependencies:
Compile InstructionsFor compilation, a C++11 compliant compiler, e.g., GCC 4.8, Clang 3.3, MSVC 2013 Update 3, is required. First, download the source code as archive or via git:
Then, depending on the version of glbinding you want to build, choose the appropriate tag or branch, e.g., for the 2.1.4 release:
The actual compilation can be done using CMake and your favorite compiler and IDE. For building glbinding CMake via command line can be used (should work on all systems): First, create a build directory (we do not recommend in-source builds):
Configure glbinding with your preferred or default generator, e.g., for Visual Studio 2015 in x64 use (note: some IDEs have integrated support for CMake projects, e.g., Qt Creator, and allow you to skip the manual project configuration):
In order to compile the project, either use you favorite Editor/IDE with the created project or use CMake as follows:
For multi-configuration projects specific configuration (e.g., on Windows using MSVC) can be built using:
Update Generated Source CodeThe generation scripts for glbinding are maintained within the khrbinding-generator project.
Assuming a directory structure with both projects such as
Tips for LinkingWe suggest using the build system CMake for a smooth integration.
For it, glbinding provides a configuration script that should be installed into your system or at least accessible by CMake.
In your projects'
Finally, just link glbinding to your own library or executable:
Dependency on KHR HeadersAs of mid 2019, the OpenGL API depends on the platform headers from the Khronos group, even on desktop systems.
This introduced a direct dependency of glbinding to the For those cases, glbinding comes with a copy of the headers for internal use. This solution has one significant downside: As those headers are used by the types of the OpenGL API and the types are used within the public interface of glbinding, the KHR/khrplatform.h UsageFor this usage scenario, glbinding needs to get built with the CMake option This decision is stored as property of the glbinding CMake target and will be used for downstream projects as well.
The use and propagation of this decision is transparent to the user as well, i.e., the user should not need to handle this downstream. The only thing to consider is to have the system-wide glbinding-internal khrplatform.h UsageFor this usage scenario, glbinding should get built with the CMake option This decision is stored as property of the glbinding CMake target and will be used for downstream projects as well. The use and propagation of this decision is transparent to the user as well, i.e., the user should not need to handle this downstream. Basic ExampleThe following examples are tailored for use with glbinding 3.0 and above. glbinding has to be initialized once on the active OpenGL context you want to use glbinding with. For initialization, a callback for function pointer resolution must be passed, which your context creation API should provide.
In the most basic case, you call
FeaturesThe following examples are tailored for use with glbinding 3.0 and above. Type-Safe ParametersThe original OpenGL API provides several concepts in their interface, namely functions, booleans, bitfields, enums, as well as special values and basic types but mostly does not differentiate between these types. Hence, actual knowledge about each function and its parameters is required; there is no way for a basic code assistance. As glbinding differentiates between all these types, IDEs and compilers can detect wrong usages of the OpenGL API. One example is the passing of a named constant in places where a bit combination is expected:
In the case of bitfields, the OpenGL API offers groups and each parameter states the group valid values must come from. glbinding uses this information to prevent invalid bit combinations:
Unfortunately, such groups are incomplete and unmaintained for enums (named values). Thus, glbinding could not provide any assistance for cases such as:
Compilation-Centered Header DesignC++ strictly separates interface from implementation. For improving the compilation time of a program or system written in C++ forward declarations of types are commonly used and includes of unnecessary symbols are omitted. For an interface of a library, class, or module providing OpenGL related functionality, it is likely that only the type information of OpenGL is needed, not actual functions or constants usually required for implementation.
In addition to the customary all-in-one header
There is one additional header that provides all extensions and provide them as an enumeration in terms of C++ enums.
Feature-Centered Header DesignThe OpenGL API is iteratively developed and released in versions, internally (for the API specification) named features. The latest feature/version of OpenGL is 4.6. The previous version are 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4., and 4.5. OpenGL uses a deprecation model for removing outdated parts of its API which results in compatibility (with deprecated API) and core (without deprecated API) usage that is manifested in the targeted OpenGL context. On top of that, new API concepts are suggested as extensions (often vendor specific) that might be integrated into future versions. All this results in many possible specific manifestations of the OpenGL API you can use in your program. One tough task is to adhere to one agreed set of functions in your own OpenGL program (e.g., OpenGL 3.2 Core if you want to develop for every Windows, macOS, and Linux released in the last 4 years). glbinding facilitates this by providing per-feature headers by means of well-defined/generated subsets of the OpenGL API. All-Features OpenGL HeadersIf you do not use per-feature headers the OpenGL program can look like this:
Single-Feature OpenGL HeadersWhen developing your code on Windows with latest drivers installed, the code above is likely to compile and run.
But if you want to port it to systems with less mature driver support (e.g., macOS or Linux using open source drivers), you may wonder if
If the code compiles you can be sure it is OpenGL 3.2 Core compliant. Using functions that are not yet available or relying on deprecated functionality is prevented. Lazy Function Pointer ResolutionBy default, glbinding tries to resolve all OpenGL function pointers during initialization, which can consume some time:
Alternatively, the user can decide that functions pointers are resolved only when used for the first time. This is achieved by:
Multi-Context Supportglbinding has built-in support for multiple contexts. The only requirement is, that the currently active context has to be specified. This feature mixes well with multi-threaded applications, but keep in mind that concurrent use of one context often results in non-meaningful communication with the OpenGL driver. In order to use multiple contexts, use your favorite context creation library (e.g., glut, SDL, egl, glfw, Qt) to request the required contexts. The functions to make a context current should be provided by these libraries and is not part of glbinding (except that you can get the current context handle). When using multiple contexts, glbinding has to be initialized for each context (when current). Since each context can correspond to a different feature set of OpenGL and the drivers are free to assign their function pointers, glbinding cannot assume any equalities of requested function pointers. Thus, contexts switches have to be communicated to glbinding explicitly in order to have correctly dispatched function pointers:
Multi-Threading SupportConcurrent use of glbinding is mainly intended for usage over multiple contexts in different threads (multiple threads operating on a single OpenGL context requires locking, which glbinding will not provide). For it, glbinding supports multiple active contexts, one per thread. This necessitates that glbinding gets informed in each thread which context is currently active (see multi-context example). Note: multi-threaded communication with OpenGL will most likely result in a meaningless sequence of OpenGL calls. To avoid this, semantic groups of OpenGL calls should be treated as critical sections. Example for usage of multiple contexts:
Multiple OpenGL Contexts in Multiple ThreadsThe combination of multiple OpenGL contexts and multiple threads for OpenGL usage is supported by glbinding in general.
You must tell glbinding which OpenGL context is used in which thread by calling the initialize method once the context is used first ( Function CallbacksTo support orthogonal features of the OpenGL API, glbinding allows attaching a number of callbacks to several concepts of the OpenGL API (e.g. a function).
Such orthogonal features include runtime error checking (i.e., glbinding supports different types of callbacks that can be registered. The main types are
The before callbacks are useful , e.g., for tracing or application-specific parameter checking.
The available information in this callback is the wrapped OpenGL function (including its name and bound function address) and all parameters.
The after callbacks are useful, e.g., for tracing, logging, or the obligatory error check ( Example for error checking:
As a shortcut, glbinding 3.0 introduced a debugging interface for error-checking after callbacks within the glbinding-aux library:
Example for logging:
Alternative SignaturesThe OpenGL API is designed without function overloading using only simple parameter types.
This results in explicit parameter encoding in function names for conceptually overloaded functions (e.g., glTexParameteri and glTexParameterf).
Another design decision for the OpenGL API is the high similarity of the integer, boolean, enum, and bitfield data types.
This means, that for overloaded functions, there is no separate function for Alternative function signatures are enabled by default, so the following example works out-of-the-box:
Meta InformationBesides an actual OpenGL binding, glbinding also supports queries for both compile time and runtime information about the gl.xml and your OpenGL driver within the glbinding-aux library. This library comes with own includes and needs to be linked seperately. Typical use cases are querying the available OpenGL extensions or the associated extensions to an OpenGL feature and their functions and enums. The following example prints out a list of all available OpenGL versions/features:
Do not miss the trending, libraries, news and articles with our weekly report.
Spin The Wheel Of Names
for a cryptographically secure random name picker.
Schedule a when to meet poll. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |