MeshLib Documentation
Loading...
Searching...
No Matches
MRImGuiImage.h
Go to the documentation of this file.
1#pragma once
2#include "exports.h"
3#include <MRMesh/MRMeshFwd.h>
5#include "MRRenderGLHelpers.h"
6
7namespace MR
8{
9
10// Simple ImGui Image
11// create GL texture in constructor, free it in destructor
12// cant be moved(for now) or copied(forever)
13class MRVIEWER_CLASS ImGuiImage
14{
15public:
16 MRVIEWER_API ImGuiImage();
17 MRVIEWER_API virtual ~ImGuiImage();
18
19 // Sets image to texture
20 MRVIEWER_API void update( const MeshTexture& texture );
21
22 // Returns void* for ImGui::Image( getImTextureId(), ... )
23 void* getImTextureId() const { return (void*) (intptr_t) glTex_.getId(); }
24
25 // Returns gl texture id
26 unsigned getId() const { return glTex_.getId(); }
27
28 // Returns current MeshTexture
29 const MeshTexture& getMeshTexture() const { return texture_; }
30
31 int getImageWidth() const { return texture_.resolution.x; }
32 int getImageHeight() const { return texture_.resolution.y; }
33
34private:
35 GlTexture2 glTex_;
36 MeshTexture texture_;
37
38 void bind_();
39};
40
41} //namespace MR
Definition MRRenderGLHelpers.h:65
Definition MRImGuiImage.h:14
int getImageWidth() const
Definition MRImGuiImage.h:31
virtual MRVIEWER_API ~ImGuiImage()
MRVIEWER_API ImGuiImage()
void * getImTextureId() const
Definition MRImGuiImage.h:23
MRVIEWER_API void update(const MeshTexture &texture)
int getImageHeight() const
Definition MRImGuiImage.h:32
const MeshTexture & getMeshTexture() const
Definition MRImGuiImage.h:29
unsigned getId() const
Definition MRImGuiImage.h:26
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshTexture.h:13