OOGL (Object-oriented OpenGL) is a C++ library that wraps the functionality of the OpenGL API in a more object-oriented package. It additionally includes various classes and functions for 3D math, loading models and textures and creating a window and OpenGL context.
To start using this library, all you need is Windows or a Linux distro and a working OpenGL driver that supports at the least OpenGL 3.2. Any libraries that OOGL depends on are included in the source, so building is as simple as
git clone git://github.com/Overv/OOGL.git
cd OOGL
make
or pressing F7 after loading the project in Visual Studio on Windows. To find out how to get started, have a look at the wiki.
To get an idea of what this library is like using in practice, have a look at the simple example below.
#include <GL/OOGL.hpp>
int main()
{
GL::Window window(800, 600, "OpenGL Window", GL::WindowStyle::Close);
GL::Context& gl = window.GetContext();
GL::Shader vert(GL::ShaderType::Vertex, "#version 150\nin vec2 position; void main() { gl_Position = vec4(position, 0.0, 1.0); }");
GL::Shader frag(GL::ShaderType::Fragment, "#version 150\nout vec4 outColor; void main() { outColor = vec4(1.0, 0.0, 0.0, 1.0); }");
GL::Program program(vert, frag);
float vertices[] = {
-0.5f, 0.5f,
0.5f, 0.5f,
0.5f, -0.5f
};
GL::VertexBuffer vbo(vertices, sizeof(vertices), GL::BufferUsage::StaticDraw);
GL::VertexArray vao;
vao.BindAttribute(program.GetAttribute("position"), vbo, GL::Type::Float, 2, 0, 0);
GL::Event ev;
while (window.IsOpen())
{
while (window.GetEvent(ev));
gl.Clear();
gl.DrawArrays(vao, GL::Primitive::Triangles, 0, 3);
window.Present();
}
return 0;
}
The sample above makes use of a lot of the abstraction OOGL offers, but it is always possible to fall back to the raw OpenGL calls.
Copyright (C) 2012 Alexander Overvoorde
Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:
The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This project is licensed under the Boost software license, of which the terms are outlined above.