Skip to content

Commit

Permalink
Refactoring WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rtoumazet committed Oct 17, 2024
1 parent 196ed91 commit f977050
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
43 changes: 24 additions & 19 deletions saturnin/src/video/opengl/opengl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <Windows.h> // removes C4005 warning
#include <imgui.h>
#include <map> // map
#include <memory> // unique_ptr
#include <mutex> // mutex
#include <string> // string
#include <tuple> // tuple
Expand Down Expand Up @@ -454,6 +455,8 @@ class Opengl {

core::Config* config_; // Configuration object.

std::unique_ptr<OpenglRender> opengl_render_; // OpenGL render object.

FboTypeToId fbo_type_to_id_; // The framebuffer objects used in the app.
u32 fbo_texture_array_id_; // Identifier for the FBO texture array.
FboTextureTypeToLayer fbo_texture_type_to_layer_; // Links the used FBO texture layer to a texture type. Index of the array
Expand Down Expand Up @@ -488,25 +491,27 @@ class Opengl {
std::string fps_; // Calculated frames per second.
};

// class OpenglRender {
// public:
// OpenglRender() = default;
// ~OpenglRender() = default;
//
// OpenglRender(const OpenglRender&) = delete;
//
// OpenglRender(OpenglRender&&) = delete;
//
// OpenglRender& operator=(const OpenglRender&) = delete;
//
// OpenglRender& operator=(OpenglRender&&) = delete;
//
// // Pre/post rendering functions
// void preRender();
// void postRender() const;
//
// private:
// };
class OpenglRender {
public:
OpenglRender() = default;
explicit OpenglRender(Opengl& opengl) : opengl_(opengl) {};
~OpenglRender() = default;

OpenglRender(const OpenglRender&) = delete;

OpenglRender(OpenglRender&&) = delete;

OpenglRender& operator=(const OpenglRender&) = delete;

OpenglRender& operator=(OpenglRender&&) = delete;

// Pre/post rendering functions
void preRender();
void postRender() const;

private:
Opengl& opengl_;
};

// Queries if the current video card is capable of rendering modern opengl (ie version 3.3+).
auto isModernOpenglCapable() -> bool;
Expand Down
4 changes: 2 additions & 2 deletions saturnin/src/video/opengl/opengl_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace gl21ext;

using core::tr;

void Opengl::preRender() {
void OpenglRender::preRender() {
switchRenderedBuffer();

glBindFramebuffer(GLenum::GL_FRAMEBUFFER, fbo_type_to_id_[FboType::general]);
Expand All @@ -63,7 +63,7 @@ void Opengl::preRender() {
glScissor(scissor_x, scissor_y, scissor_width, scissor_height);
};

void Opengl::postRender() const {
void OpenglRender::postRender() const {
// Framebuffer is released
checkGlError();

Expand Down

0 comments on commit f977050

Please sign in to comment.