matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
492 stars 72 forks source link

Using glBindings #132

Open kestrelm opened 8 years ago

kestrelm commented 8 years ago

Hello,

How should one go about using glBinding ( https://github.com/cginternals/glbinding ) as the extension loading library for oglplus in place of glew?

Thanks

matus-chochlik commented 8 years ago

Hi,

I didn't try OGLplus with GL bindings yet (and it is not supported in the build system), but generally you should include the glBinding headers /before/ any oglplus headers and call the glBinding initialization code before calling any oglplus functions or creating oglplus GL-object-related classes:

#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>
#include <oglplus/all.hpp>

using namespace gl;

int main()
{
  // create context, e.g. using GLFW, Qt, SDL, GLUT, ...

  glbinding::Binding::initialize();

  oglplus::Context ctx;
  ctx.ClearColor(1.0, 0.0, 0.0, 0.0);
  ctx.Clear().ColorBuffer();
  ...
}