Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Overload/OvGame/include/OvGame/Core/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace OvGame::Core
std::unique_ptr<OvAudio::Core::AudioEngine> audioEngine;
std::unique_ptr<OvAudio::Core::AudioPlayer> audioPlayer;
std::unique_ptr<OvCore::Scripting::ScriptInterpreter> scriptInterpreter;
std::unique_ptr<OvRendering::Buffers::Framebuffer> framebuffer;

OvCore::SceneSystem::SceneManager sceneManager;

Expand Down
2 changes: 2 additions & 0 deletions Sources/Overload/OvGame/src/OvGame/Core/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ OvGame::Core::Context::Context() :

/* Scripting */
scriptInterpreter = std::make_unique<OvCore::Scripting::ScriptInterpreter>(projectScriptsPath);

framebuffer = std::make_unique<OvRendering::Buffers::Framebuffer>(windowSettings.width, windowSettings.height);
}

OvGame::Core::Context::~Context()
Expand Down
4 changes: 4 additions & 0 deletions Sources/Overload/OvGame/src/OvGame/Core/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void RenderCurrentScene(
frameDescriptor.renderWidth = windowWidth;
frameDescriptor.renderHeight = windowHeight;
frameDescriptor.camera = camera->GetCamera();
frameDescriptor.outputBuffer = *p_context.framebuffer;

p_renderer.BeginFrame(frameDescriptor);
p_renderer.DrawFrame();
Expand Down Expand Up @@ -120,6 +121,9 @@ void OvGame::Core::Game::Update(float p_deltaTime)
}

RenderCurrentScene(m_sceneRenderer, m_context);

auto [windowWidth, windowHeight] = m_context.window->GetSize();
m_context.framebuffer->BlitToBackBuffer(windowWidth, windowHeight);
}

m_context.sceneManager.Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ namespace OvRendering::Buffers
*/
void GenerateMipMaps() const;

/**
* Blit the framebuffer to the back buffer
* @param p_backBufferWidth
* @param p_backBufferHeight
*/
void BlitToBackBuffer(uint16_t p_backBufferWidth, uint16_t p_backBufferHeight) const;

private:
uint16_t m_width = 0;
uint16_t m_height = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,11 @@ void OvRendering::Buffers::Framebuffer::GenerateMipMaps() const
glGenerateMipmap(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
}

void OvRendering::Buffers::Framebuffer::BlitToBackBuffer(uint16_t p_backBufferWidth, uint16_t p_backBufferHeight) const
{
glBlitNamedFramebuffer(m_bufferID, 0,
0, 0, m_width, m_height,
0, 0, p_backBufferWidth, p_backBufferHeight,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
}