Working on RenderTarget example
This commit is contained in:
46
src/dawnopengl/display/BackBufferRenderTarget.cpp
Normal file
46
src/dawnopengl/display/BackBufferRenderTarget.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "BackBufferRenderTarget.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
BackBufferRenderTarget::BackBufferRenderTarget(
|
||||
std::weak_ptr<RenderManager> renderManager
|
||||
) {
|
||||
this->renderManager = renderManager;
|
||||
}
|
||||
|
||||
float_t BackBufferRenderTarget::getWidth() {
|
||||
return this->width;
|
||||
}
|
||||
|
||||
float_t BackBufferRenderTarget::getHeight() {
|
||||
return this->height;
|
||||
}
|
||||
|
||||
void BackBufferRenderTarget::setSize(float_t width, float_t height) {
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
void BackBufferRenderTarget::setClearColor(struct Color color) {
|
||||
this->clearColor = color;
|
||||
}
|
||||
|
||||
void BackBufferRenderTarget::clear(flag8_t clearFlags) {
|
||||
glClearColor(
|
||||
this->clearColor.r,
|
||||
this->clearColor.g,
|
||||
this->clearColor.b,
|
||||
this->clearColor.a
|
||||
);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void BackBufferRenderTarget::bind() {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(0, 0, (GLsizei)this->width, (GLsizei)this->height);
|
||||
}
|
Reference in New Issue
Block a user