OpenGLBackend Class
Applies render-pass state and executes OpenGL draw calls. More...
Declaration
Public Constructors Index
| OpenGLBackend (EngineWorld &engineWorld) | |
|
Constructs the backend bound to the engine world. More... | |
Public Member Functions Index
| void | beginRenderTargetBatch (const RenderTargetHandle renderTargetHandle) noexcept |
|
Begins processing for one render-target batch. More... | |
| void | endRenderTargetBatch (const RenderTargetHandle renderTargetHandle) noexcept |
|
Ends processing for one render-target batch. More... | |
| void | beginViewportBatch (const ViewportHandle viewportHandle) noexcept |
|
Begins processing for one viewport batch. More... | |
| void | endViewportBatch (const ViewportHandle viewportHandle) noexcept |
|
Ends processing for one viewport batch. More... | |
| void | beginShaderBatch (ShaderHandle shaderHandle) noexcept |
|
Begins processing for one shader batch. More... | |
| void | endShaderBatch (ShaderHandle handle) noexcept |
|
Ends processing for one shader batch. More... | |
| void | beginMaterialBatch (MaterialHandle materialHandle) noexcept |
|
Begins processing for one material batch. More... | |
| void | endMaterialBatch (MaterialHandle handle) noexcept |
|
Ends processing for one material batch. More... | |
| void | beginMeshBatch (MeshHandle meshHandle) noexcept |
|
Begins processing for one mesh batch. More... | |
| void | endMeshBatch (MeshHandle handle) noexcept |
|
Ends processing for one mesh batch. More... | |
template <typename THandle> | |
| void | renderBatch (std::span< SceneMemberRenderContext< THandle > > sceneMemberRenderContexts) noexcept |
|
Renders all draw contexts of the current mesh batch. More... | |
| void | provideWindowHints () noexcept |
|
Applies window hints for an OpenGL core-profile context. More... | |
| bool | init () noexcept |
|
Initializes OpenGL function pointers through GLFW. More... | |
| bool | isInitialized () const noexcept |
|
Reports whether OpenGL function loading completed successfully. More... | |
Private Member Functions Index
| std::optional< ViewProjection > | viewProjection (const ViewportEntity &vieportEntity) const noexcept |
|
Resolves view and projection matrices for a viewport's bound camera. More... | |
template <typename TUniformScope> | |
| void | writeUniformValues (ShaderEntity shaderEntity, UniformValueBag< TUniformScope > &uniformValueBag) noexcept |
|
Uploads cached uniform values for a specific uniform scope. More... | |
Private Member Attributes Index
| bool | isInitialized_ = false |
|
Tracks whether GL function pointers were initialized. More... | |
| OpenGLMeshComponent< MeshHandle > * | currentOpenGLMesh_ = nullptr |
|
Cached pointer to the currently bound OpenGL mesh component. More... | |
| UniformValueBag< UniformScope::Pass > | passUniformValueBag_ {} |
|
Cached pass-scope uniforms (typically view/projection). More... | |
| UniformValueBag< UniformScope::Draw > | drawUniformValueBag_ {} |
|
Cached draw-scope uniforms (for example model matrix/material color). More... | |
| RenderTargetHandle | currentRenderTargetHandle_ {} |
|
Currently active render target for nested viewport processing. More... | |
| ShaderHandle | currentShaderHandle_ {} |
|
Currently bound shader to avoid redundant glUseProgram calls. More... | |
| EngineWorld & | engineWorld_ |
|
Engine world used to resolve render entities and components. More... | |
Private Static Attributes Index
| static const helios::engine::util::log::Logger & | logger_ = ... |
Description
Applies render-pass state and executes OpenGL draw calls.
OpenGLBackend is intentionally thin and stateful: it references existing worlds and translates ECS render data into OpenGL state changes.
Definition at line 87 of file OpenGLBackend.ixx.
Public Constructors
OpenGLBackend()
| inline explicit |
Constructs the backend bound to the engine world.
- Parameters
-
engineWorld Engine world providing render resources and targets.
Definition at line 213 of file OpenGLBackend.ixx.
Public Member Functions
beginMaterialBatch()
| inline noexcept |
Begins processing for one material batch.
Loads material-scope values (for example base color) into draw-scope uniforms.
- Parameters
-
materialHandle Material handle for this batch.
Definition at line 384 of file OpenGLBackend.ixx.
beginMeshBatch()
| inline noexcept |
Begins processing for one mesh batch.
Resolves and binds the mesh VAO used for all draw contexts in the batch.
- Parameters
-
meshHandle Mesh handle for this batch.
Definition at line 415 of file OpenGLBackend.ixx.
beginRenderTargetBatch()
| inline noexcept |
Begins processing for one render-target batch.
Binds the framebuffer, validates it in debug builds, and initializes pass-independent GL state such as blending and clear color.
- Parameters
-
renderTargetHandle Render-target handle for this batch.
Definition at line 224 of file OpenGLBackend.ixx.
beginShaderBatch()
| inline noexcept |
Begins processing for one shader batch.
Binds the shader program and uploads pass-scope uniforms.
- Parameters
-
shaderHandle Shader handle for this batch.
Definition at line 346 of file OpenGLBackend.ixx.
beginViewportBatch()
| inline noexcept |
Begins processing for one viewport batch.
Resolves camera matrices, configures viewport/scissor rectangles, and performs optional clears according to the active render target clear flags.
- Parameters
-
viewportHandle Viewport handle for this batch.
Definition at line 281 of file OpenGLBackend.ixx.
endMaterialBatch()
| inline noexcept |
Ends processing for one material batch.
- Parameters
-
handle Material handle for this batch.
Definition at line 404 of file OpenGLBackend.ixx.
endMeshBatch()
| inline noexcept |
Ends processing for one mesh batch.
- Parameters
-
handle Mesh handle for this batch.
Definition at line 440 of file OpenGLBackend.ixx.
endRenderTargetBatch()
| inline noexcept |
Ends processing for one render-target batch.
Clears current render-target state and resets cached pass/draw uniform values.
- Parameters
-
renderTargetHandle Render-target handle for this batch.
Definition at line 266 of file OpenGLBackend.ixx.
endShaderBatch()
| inline noexcept |
Ends processing for one shader batch.
- Parameters
-
handle Shader handle for this batch.
Definition at line 373 of file OpenGLBackend.ixx.
endViewportBatch()
| inline noexcept |
Ends processing for one viewport batch.
- Parameters
-
viewportHandle Viewport handle for this batch.
Definition at line 335 of file OpenGLBackend.ixx.
init()
| inline noexcept |
Initializes OpenGL function pointers through GLFW.
- Precondition
A valid, current OpenGL context exists on the calling thread.
- Postcondition
isInitialized() returns true on success.
- Returns
true if loading succeeded, otherwise false.
Definition at line 506 of file OpenGLBackend.ixx.
isInitialized()
| inline noexcept |
Reports whether OpenGL function loading completed successfully.
Definition at line 529 of file OpenGLBackend.ixx.
provideWindowHints()
| inline noexcept |
Applies window hints for an OpenGL core-profile context.
The backend currently requests OpenGL 4.1 core profile for macOS compatibility.
Definition at line 491 of file OpenGLBackend.ixx.
renderBatch()
| inline noexcept |
Renders all draw contexts of the current mesh batch.
Writes draw-scope uniforms per context and submits one indexed glDrawElements call per entry.
- Template Parameters
-
THandle Scene member handle type.
- Parameters
-
sceneMemberRenderContexts Draw contexts belonging to the active mesh batch.
Definition at line 455 of file OpenGLBackend.ixx.
References helios::opengl::components::OpenGLMeshComponent< TOwnerHandle >::indexCount and helios::opengl::components::OpenGLMeshComponent< TOwnerHandle >::primitiveType.
Private Member Functions
viewProjection()
| inline noexcept |
Resolves view and projection matrices for a viewport's bound camera.
- Parameters
-
updateContext Current frame update context.
viewportHandle Viewport to resolve camera matrices for.
- Returns
View/projection pair on success, otherwise std::nullopt.
Definition at line 146 of file OpenGLBackend.ixx.
writeUniformValues()
| inline noexcept |
Uploads cached uniform values for a specific uniform scope.
Resolves OpenGLUniformWriteOperationsComponent<ShaderHandle, TUniformScope> on the shader entity and forwards its operation list plus values from UniformValueBag to OpenGLUniformWriter. If no write-plan component exists, the method logs an error and asserts in debug builds.
- Template Parameters
-
TUniformScope Uniform lifetime scope (for example pass or draw).
- Parameters
-
shaderEntity Shader entity holding location cache and shader data.
uniformValueBag Source values to upload for this scope.
Definition at line 190 of file OpenGLBackend.ixx.
Private Member Attributes
currentOpenGLMesh_
|
Cached pointer to the currently bound OpenGL mesh component.
Definition at line 103 of file OpenGLBackend.ixx.
currentRenderTargetHandle_
|
Currently active render target for nested viewport processing.
Definition at line 118 of file OpenGLBackend.ixx.
currentShaderHandle_
|
Currently bound shader to avoid redundant glUseProgram calls.
Definition at line 123 of file OpenGLBackend.ixx.
drawUniformValueBag_
|
Cached draw-scope uniforms (for example model matrix/material color).
Definition at line 113 of file OpenGLBackend.ixx.
engineWorld_
|
Engine world used to resolve render entities and components.
Definition at line 129 of file OpenGLBackend.ixx.
isInitialized_
|
Tracks whether GL function pointers were initialized.
Definition at line 94 of file OpenGLBackend.ixx.
passUniformValueBag_
|
Cached pass-scope uniforms (typically view/projection).
Definition at line 108 of file OpenGLBackend.ixx.
Private Static Attributes
logger_
| static |
- Initialiser
-
= helios::engine::util::log::LogManager::loggerForScope( HELIOS_LOG_SCOPE )
Definition at line 96 of file OpenGLBackend.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.