Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ehwan/ehgl
gl c++ wrapper
https://github.com/ehwan/ehgl
Last synced: 10 days ago
JSON representation
gl c++ wrapper
- Host: GitHub
- URL: https://github.com/ehwan/ehgl
- Owner: ehwan
- License: mit
- Created: 2016-09-27T15:25:33.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-27T11:46:01.000Z (4 months ago)
- Last Synced: 2024-06-27T16:16:26.155Z (4 months ago)
- Language: C++
- Size: 151 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ehgl
header-only OpenGL c++ wrapperRAII based GL Objects and memory allocation
- This project is using `Eigen` for Perspective & Camera matrix construction ( `eg/math.hpp` )
and `SFML` for debug window creation ( `eg/debug_window.hpp` ).- comment out those files in `eg.hpp` to remove dependancy.
- for your own OpenGL Loader, include main header file to `eg/gl.hpp`
## Sample Code
```cpp
// example/mandelbrot/mandelbrot.cpp#include
// GL Program object
eg::Program program;
// GL VertexArrayObject object
eg::VertexArray varray;// SFML windows ( for test )
eg::debug::window_context window;int main()
{
/*
...
*/std::cout << "OpenGL Version " << eg::context.major_version() << "." << eg::context.minor_version() << std::endl;
std::cout << "Vendor : " << eg::context.vendor() << std::endl;
std::cout << "Renderer : " << eg::context.renderer() << std::endl;
std::cout << "Shader : " << eg::context.shading_version() << std::endl;// program creation & linkage
{
// make vertex shader
auto vertex = eg::make_shader( GL_VERTEX_SHADER );
vertex.source( vertex_shader );
vertex.compile();// make fragment shader
auto fragment = eg::make_shader( GL_FRAGMENT_SHADER );
fragment.source( fragment_shader );
fragment.compile();// make program
program = eg::make_program();
program.attachShader( vertex );
program.attachShader( fragment );
program.bindFragDataLocation( 0, "outcol" );
if( program.link_detach() == false )
{
std::cout << "program link failed : \n" << program.errorMessage() << std::endl;
return 0;
}
}
varray = eg::make_vertex_array();
window.run();return 0;
}```