Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::render::opengl Namespace Reference

OpenGL backend of the renderer. More...

Classes

class  Context
 OpenGL core profile context of a window, with every OpenGL function loaded. More...
 
struct  ContextConfig
 Settings of a new context. More...
 
class  ContextError
 Thrown when the OpenGL context cannot be created or is too old. More...
 
struct  DriverInfo
 Driver strings of a context. More...
 
class  Renderer
 IRenderer drawing into a window with OpenGL. More...
 
class  ShaderError
 Thrown when a shader does not compile or a program does not link. More...
 
class  ShaderProgram
 Vertex and fragment shaders linked into one OpenGL program. More...
 
struct  ShaderSources
 GLSL sources of a program, without #version line. More...
 
class  Texture
 An image on the GPU, ready to be drawn. More...
 
struct  Version
 Version of an OpenGL context. More...
 

Enumerations

enum class  DebugOutput : std::uint8_t { Off , Callback , Polling }
 How a context reports OpenGL errors. More...
 
enum class  DrawMode : std::uint8_t { Batched , Naive }
 How end_frame() sends the sprites to the GPU. More...
 

Functions

bool debug_build () noexcept
 Whether the engine was built for debugging.
 

Detailed Description

OpenGL backend of the renderer.

Only this backend sees OpenGL; a Direct3D or Vulkan backend would live next to it and attach to the same platform::Window.

Enumeration Type Documentation

◆ DebugOutput

enum class aegis2d::render::opengl::DebugOutput : std::uint8_t
strong

How a context reports OpenGL errors.

Enumerator
Off 

Errors are not reported (release builds by default).

Callback 

The driver reports each error, warning and hint as it happens (KHR_debug, OpenGL 4.3 and later).

Polling 

Errors are read with glGetError by each swap_buffers() and check_errors() call (macOS, which stops at OpenGL 4.1).

◆ DrawMode

enum class aegis2d::render::opengl::DrawMode : std::uint8_t
strong

How end_frame() sends the sprites to the GPU.

Enumerator
Batched 

The vertices of the whole frame sent at once, then one draw call per run of sprites sharing a layer and a texture (batch_sprites()): the default.

Naive 

One upload, texture bind and draw call per sprite, in the same order: what a renderer without batching does, to measure what batching saves.

Function Documentation

◆ debug_build()

bool aegis2d::render::opengl::debug_build ( )
noexcept

Whether the engine was built for debugging.

Returns
true when the engine was compiled without NDEBUG (Debug builds).