easy-gl › Capabilities
Capabilities
Populated automatically by Device::initialize(). Provides read-only access to the GL context information, supported features and implementation limits.
Accessing capabilities
const auto& caps = device.capabilities();
const auto& info = caps.context_info();
std::cout << "Vendor: " << info.vendor << '\n';
std::cout << "Renderer: " << info.renderer << '\n';
std::cout << "Version: " << info.version_string << '\n';
std::cout << "GLSL: " << info.shading_language_version << '\n';
std::cout << "API kind: " << (caps.is_opengl() ? "OpenGL" : "OpenGL ES") << '\n';
std::cout << "GL >= 4.1: " << caps.is_at_least(4, 1) << '\n';
Feature checks
if (caps.supports(easygl::Feature::ComputeShader)) { ... }
if (caps.supports(easygl::Feature::AnisotropicFiltering)) { ... }
Extension check
if (caps.supports_extension("GL_ARB_bindless_texture")) {
// use bindless textures
}
Implementation limits
int maxTexUnits = caps.get_limit("MAX_COMBINED_TEXTURE_IMAGE_UNITS");
int maxUboSize = caps.get_limit("MAX_UNIFORM_BLOCK_SIZE");
int maxComputeX = caps.get_limit("MAX_COMPUTE_WORK_GROUP_SIZE_X");
Feature enum reference
| Feature | Minimum GL | Description |
|---|---|---|
VertexArrayObject | 3.0 | VAO support |
Shader | 2.0 | Programmable shaders |
Program | 2.0 | Linked shader programs |
Buffer | 1.5 | VBOs |
BasicRendering | 1.0 | Draw calls, clear |
DebugOutput | 4.3 / KHR_debug | GL debug callback |
ComputeShader | 4.3 | Compute shaders |
GeometryShader | 3.2 | Geometry shaders |
TessellationShader | 4.0 | Tessellation stages |
Texture3D | 1.2 | 3D texture targets |
TextureFloat | 3.0 / ARB_texture_float | Float internal formats |
TextureRG | 3.0 / ARB_texture_rg | Red/RG-only formats |
SamplerObject | 3.3 | Sampler objects |
Instancing | 3.1 | Instanced draw calls |
UniformBufferObject | 3.1 | UBOs |
FramebufferObject | 3.0 | FBOs |
Multisampling | 3.2 | MSAA |
DrawBuffers | 2.0 | MRT |
MapBuffer | 1.5 | Buffer mapping |
DirectStateAccess | 4.5 | DSA calls |
TextureCompression | 1.3 | Compressed texture formats |
AnisotropicFiltering | EXT_texture_filter_anisotropic | Anisotropic filtering |
Method reference
| Method | Description |
|---|---|
context_info() | Returns ContextInfo struct. |
supports(Feature) | True if the feature is available. |
supports_extension(name) | True if the named extension is present. |
get_limit(name) | Return a named implementation limit as int. |
is_opengl() | True if desktop OpenGL context. |
is_opengles() | True if OpenGL ES context. |
is_at_least(major, minor) | True if context version ≥ major.minor. |