Files
pixelarium/lib/rendering/CvMatRender.hpp
T

37 lines
929 B
C++
Raw Normal View History

2025-03-14 19:32:40 +01:00
#pragma once
2025-03-17 10:44:56 +01:00
// windows. must come before GL/GL.h here.
// clang format would change this, effectively rendering the build broken.
// clang-format off
#include <memory>
2025-03-14 19:32:40 +01:00
#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/Image.hpp"
2025-03-17 10:44:56 +01:00
// clang-format on
2025-03-14 19:32:40 +01:00
namespace pixelarium::render
{
2025-03-17 10:44:56 +01:00
static void matToTexture(const cv::Mat& image, GLuint* texture);
2025-03-14 19:32:40 +01:00
class CvMatRender
{
public:
2025-03-17 10:44:56 +01:00
CvMatRender() = default;
explicit CvMatRender(const std::shared_ptr<pixelarium::imaging::Image>& img);
GLuint* Render();
2025-03-17 17:33:31 +01:00
GLuint* Render(float factor);
GLuint* Render(size_t width, size_t height);
2025-03-14 19:32:40 +01:00
private:
cv::Mat _img;
2025-03-17 10:44:56 +01:00
std::shared_ptr<pixelarium::imaging::Image> _base;
2025-03-14 19:32:40 +01:00
GLuint _texture;
};
} // namespace pixelarium::render