diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-04-30 13:12:35 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2019-04-30 13:12:35 +0200 |
commit | 868ba6279a20e4d1412c2d576c67400167de6694 (patch) | |
tree | a7090b2da96987c4c532c5bedf812df20f604964 /src/Framebuffer.cpp | |
parent | Second iteration of changing to single-threaded model (diff) | |
download | AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar.gz AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar.bz2 AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar.lz AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar.xz AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.tar.zst AltCraft-868ba6279a20e4d1412c2d576c67400167de6694.zip |
Diffstat (limited to 'src/Framebuffer.cpp')
-rw-r--r-- | src/Framebuffer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index fb7ebc7..d81b0e0 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -3,11 +3,13 @@ #include <string> #include "Utility.hpp" #include "AssetManager.hpp" +#include <optick.h> const GLuint magic = 316784; GLuint quadVao = magic, quadVbo = magic; Framebuffer::Framebuffer(unsigned int width, unsigned int height, bool createDepthStencilBuffer) : width(width), height(height) { + OPTICK_EVENT(); if (quadVao == magic) { float quadVertices[] = { // positions // texCoords @@ -70,11 +72,13 @@ Framebuffer::~Framebuffer() { } void Framebuffer::Activate() { + OPTICK_EVENT(); glViewport(0, 0, width, height); glBindFramebuffer(GL_FRAMEBUFFER, fbo); } void Framebuffer::RenderTo(Framebuffer &target) { + OPTICK_EVENT(); glBindFramebuffer(GL_FRAMEBUFFER, target.fbo); glViewport(0, 0, target.width, target.height); AssetManager::GetAsset<AssetShader>("/altcraft/shaders/fbo")->shader->Activate(); @@ -96,8 +100,8 @@ void Framebuffer::Resize(unsigned int newWidth, unsigned int newHeight) { } } -Framebuffer &Framebuffer::GetDefault() -{ +Framebuffer &Framebuffer::GetDefault() { + OPTICK_EVENT(); static char fboDefaultData[sizeof(Framebuffer)]; static Framebuffer *fboDefault = nullptr; if (fboDefault == nullptr) { @@ -111,8 +115,8 @@ Framebuffer &Framebuffer::GetDefault() return *fboDefault; } -void Framebuffer::Clear(bool color, bool depth, bool stencil) -{ +void Framebuffer::Clear(bool color, bool depth, bool stencil) { + OPTICK_EVENT(); Activate(); GLbitfield clearBits = 0; if (color) |