d71f4168fb
* logger business * code review * rm c-style array * extract image rendering to view * missing view files * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * extract image rendering to view * missing view files * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * Factor out AppGLFW base class The intention here is to get rid of scaffolding in the consumer application class and allow to focus on the "important bits". * Some cleanup * dump unnecessary dependency * link stuff where needed & use only what's needed * remove deprecation warnings * add gallery toggle * make some includes private * add presets * remove dir locals, use presets instead `projectile-configure-project' in conjunction with CMakePresets.json will allow to configure the project. `projectile-compile-project' does sth similar for the compile command. This is equivalent to something like ~cmake --preset clang-debug && cmake --build build --preset clang-debug~ * use presets in pipeline --------- Co-authored-by: m-aXimilian <keuffnermax@gmail.com>
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
#pragma once
|
|
// windows.h must come before GL/GL.h here.
|
|
// clang format would change this, effectively rendering the build broken.
|
|
// clang-format off
|
|
#include <memory>
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#include <GL/GL.h>
|
|
#else
|
|
#define GL_SILENCE_DEPRECATION
|
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
|
#include <GLES2/gl2.h>
|
|
#endif
|
|
#include <GLFW/glfw3.h> // Will drag system OpenGL headers
|
|
#endif
|
|
#include "imaging/PixelariumImage.hpp"
|
|
// clang-format on
|
|
|
|
namespace pixelarium::render
|
|
{
|
|
class CvMatRender
|
|
{
|
|
public:
|
|
// we want the default constructor for the time being
|
|
// (although it does not make much sense and should
|
|
// get removed in the future)
|
|
// as the using AppGLFW constructs it empty as a member
|
|
// when coming to life.
|
|
CvMatRender() = default;
|
|
CvMatRender(CvMatRender&) = delete;
|
|
CvMatRender(const CvMatRender&) = delete;
|
|
CvMatRender(CvMatRender&&) = delete;
|
|
CvMatRender& operator=(CvMatRender&) = default;
|
|
CvMatRender& operator=(CvMatRender&& other) = default;
|
|
~CvMatRender();
|
|
explicit CvMatRender(const std::shared_ptr<pixelarium::imaging::PixelariumImage>& img);
|
|
|
|
public:
|
|
GLuint Render();
|
|
GLuint Render(float factor);
|
|
GLuint Render(size_t width, size_t height);
|
|
void ResetRenderImage() { this->img_ = this->base_->GetImage().clone(); }
|
|
void ResetRenderImage(const std::shared_ptr<pixelarium::imaging::PixelariumImage>& img);
|
|
|
|
private:
|
|
cv::Mat img_;
|
|
std::shared_ptr<pixelarium::imaging::PixelariumImage> base_;
|
|
GLuint texture_;
|
|
|
|
GLuint uploadTexture();
|
|
};
|
|
|
|
} // namespace pixelarium::render
|