OGLplus (0.52.0) a C++ wrapper for OpenGL

Direct-State-Access (DSA) objects

DSA objects allow to use objects that can to be bound to a OpenGL binding point or "target" without binding them. This includes objects like Buffer, Texture, Renderbuffer or Framebuffer which have a target to which individual instances can be bound and operated on through the binding point. DSA objects implement (mostly) the same functions as their non-DSA counterparts but without the target parameter and the operations are invoked on the instances themselves.

For example to setup a texture object one might need to do the following:

// create the texture
Texture tex;
// the binding point we'll be using to setup the texture
Texture::Target tex_tgt = Texture::Target::_2D;
tex.Bind(tex_tgt);
{
Texture::Image2D(tex_tgt, ...);
Texture::GenerateMipmap(tex_tgt);
Texture::MinFilter(tex_tgt, TextureMinFilter::Linear);
Texture::MagFilter(tex_tgt, TextureMagFilter::Linear);
Texture::WrapS(tex_tgt, TextureWrap::Repeat);
Texture::WrapT(tex_tgt, TextureWrap::Repeat);
Texture::SwizzleG(tex_tgt, TextureSwizzle::Red);
Texture::SwizzleB(tex_tgt, TextureSwizzle::Red);
}

The DSATexture class allows to do things more conveniently:

// create the texture
DSATexture dsa_tex;
// specify the default target for this texture
dsa_tex.target = Texture::Target::_2D;
dsa_tex.Image2D(...);
dsa_tex.GenerateMipmap();
dsa_tex.MinFilter(TextureMinFilter::Linear);
dsa_tex.MagFilter(TextureMagFilter::Linear);
dsa_tex.WrapS(TextureWrap::Repeat);
dsa_tex.WrapT(TextureWrap::Repeat);
dsa_tex.SwizzleG(TextureSwizzle::Red);
dsa_tex.SwizzleB(TextureSwizzle::Red);
dsa_tex.Bind();

In order to be able to use the DSA objects it is necessary to include the appropriate header:

#include <oglplus/texture_dsa.hpp> // DSATexture
#include <oglplus/buffer_dsa.hpp> // DSABuffer
#include <oglplus/framebuffer_dsa.hpp> // DSAFramebuffer
#include <oglplus/renderbuffer_dsa.hpp> // DSARenderbuffer
#include <oglplus/vertex_array_dsa.hpp> // DSAVertexArray

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).