https://github.com/acdemiralp/gl
Header-only C++17 wrapper for OpenGL 4.6 Core Profile.
https://github.com/acdemiralp/gl
cpp11 opengl wrapper
Last synced: 17 days ago
JSON representation
Header-only C++17 wrapper for OpenGL 4.6 Core Profile.
- Host: GitHub
- URL: https://github.com/acdemiralp/gl
- Owner: acdemiralp
- License: bsl-1.0
- Created: 2017-08-04T11:35:21.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2021-12-05T16:49:30.000Z (over 3 years ago)
- Last Synced: 2024-11-14T22:35:40.448Z (6 months ago)
- Topics: cpp11, opengl, wrapper
- Language: C++
- Homepage:
- Size: 3.35 MB
- Stars: 158
- Watchers: 16
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
- AwesomeCppGameDev - gl
README
#### GL
Complete C++17 wrapper for OpenGL 4.6 Core Profile.---
#### Dependencies
* OpenGL
* GLEW
* CUDA (optional, for interoperation support)---
#### Building
* Follow the cmake build process for locating the dependencies.
* Toggle CUDA_INTEROP_SUPPORT for CUDA interoperation support. Note that the build will ask for the location of Cuda upon enabling this option.---
#### Getting Started
Creating and uploading data to buffers:
```cpp
#includevoid buffer_example()
{
gl::buffer buffer;
std::vector vertices(32);
buffer.set_data(sizeof(float) * vertices.size(), vertices.data());
}
```Creating and uploading data to textures:
```cpp
#includevoid texture_example()
{
gl::texture_1d texture_1d;
texture_1d.set_min_filter(GL_LINEAR);
texture_1d.set_mag_filter(GL_LINEAR);
texture_1d.set_wrap_s (GL_CLAMP );
std::array scalars;
texture_1d.set_storage (0, GL_RGBA, sizeof(float) * scalars.size());
texture_1d.set_sub_image (0, 0, scalars.size(), GL_RGBA, GL_FLOAT, scalars.data());
}
```
Creating shaders and attaching them to programs:
```cpp
#includevoid shader_program_example()
{
gl::shader vert_shader(GL_VERTEX_SHADER);
vert_shader.load_source("vert_example.glsl");gl::shader frag_shader(GL_FRAGMENT_SHADER);
frag_shader.load_source("frag_example.glsl");gl::program program;
program.attach_shader(vert_shader);
program.attach_shader(frag_shader);
program.link();
program.use();
program.set_uniform(program.uniform_location("example_uniform"), 42);
program.unuse();
}
```---
#### Extensions
For adding GLM support to type-inferring uniform variable setters of the shader program, simply `#include `.