Files
pixelarium/lib/app/rendering/CvMatRender.hpp
T
m-aXimilian b37814204f Misc (#19)
* get image returns optional<Mat> instead of unique_ptr<Mat>

* introduce complexity

* rename image load function

* add example for a basic reader for binary image files

* fix windows build?

* add a status bar underneath the menu bar

* use status bar in custom_0 example app

* clang formats

* packing w/ pragma push

* add "Save As" functions to image views

* resize over reserve

* rm local override uri

* add simple thread pool

* rename to simple_thread_pool

* get rid of useless renderlib

* document version inc

* extract hardcoded values to in-header

* clang format patch

* clone registered image in custom_0

* document binary-file header

* minor fixes

* clang format

* rm unused render cmake
2026-02-16 20:36:48 +01:00

53 lines
1.4 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
#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 <opencv2/core/mat.hpp>
// clang-format on
namespace pixelarium::application
{
/// @brief Renders cv::Mat bitmaps as OpenGL textures.
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&) = delete;
CvMatRender& operator=(CvMatRender&& other) = delete;
~CvMatRender();
explicit CvMatRender(const cv::Mat& img);
public:
GLuint Render();
GLuint Render(float factor);
GLuint Render(size_t width, size_t height);
void ResetRenderImage();
private:
cv::Mat img_;
const cv::Mat& base_;
GLuint texture_;
GLuint uploadTexture();
};
} // namespace pixelarium::application