MeshLib
 
Loading...
Searching...
No Matches
MRGLStaticHolder.h
Go to the documentation of this file.
1#pragma once
2#include "MRRenderHelpers.h"
3#include "MRMesh/MRLog.h"
4#include <array>
5
6namespace MR
7{
8// This class holds all shaders that are used in the program
9// creates shader on access if it is needed
10// holds shared memory buffer for loading to GPU
11class MRVIEWER_CLASS GLStaticHolder
12{
13public:
14 typedef unsigned int GLuint;
47
48 // Creates shader if it is not and return valid id
49 MRVIEWER_API static GLuint getShaderId( ShaderType type );
50 // Free shader from GL
51 MRVIEWER_API static void freeShader( ShaderType type );
52 // Free all shaders from GL
53 MRVIEWER_API static void freeAllShaders();
54 // Memory buffer for objects that about to be loaded to GPU, shared among different data types
55 MRVIEWER_API static RenderObjectBuffer& getStaticGLBuffer();
56private:
59
60 static GLStaticHolder& instance_();
61
62 void createShader_( ShaderType type );
63
64 std::array<GLuint, size_t( Count )> shadersIds_;
65
66 // it is stored here to prolong its life till this destructor
67 std::shared_ptr<spdlog::logger> logger_;
68
69 RenderObjectBuffer glBuffer_;
70};
71}
Definition MRGLStaticHolder.h:12
ShaderType
Definition MRGLStaticHolder.h:16
@ Picker
Definition MRGLStaticHolder.h:18
@ Mesh
Definition MRGLStaticHolder.h:17
@ TransparentMesh
Definition MRGLStaticHolder.h:20
@ Volume
Definition MRGLStaticHolder.h:43
@ Points
Definition MRGLStaticHolder.h:22
@ LinesPicker
Definition MRGLStaticHolder.h:27
@ ViewportBorder
Definition MRGLStaticHolder.h:38
@ Labels
Definition MRGLStaticHolder.h:32
@ TransparentPoints
Definition MRGLStaticHolder.h:23
@ SimpleOverlayQuad
Definition MRGLStaticHolder.h:41
@ AdditionalQuad
Definition MRGLStaticHolder.h:37
@ ShadowOverlayQuad
Definition MRGLStaticHolder.h:40
@ AdditionalPointsNoOffset
Definition MRGLStaticHolder.h:36
@ VolumePicker
Definition MRGLStaticHolder.h:44
@ MeshDesktopPicker
Definition MRGLStaticHolder.h:19
@ AdditionalPoints
Definition MRGLStaticHolder.h:35
@ LinesJoint
Definition MRGLStaticHolder.h:26
@ TransparentLines
Definition MRGLStaticHolder.h:30
@ AdditionalLines
Definition MRGLStaticHolder.h:34
@ LinesJointPicker
Definition MRGLStaticHolder.h:28
@ TransparencyOverlayQuad
Definition MRGLStaticHolder.h:39
@ Lines
Definition MRGLStaticHolder.h:25
static MRVIEWER_API void freeShader(ShaderType type)
static MRVIEWER_API RenderObjectBuffer & getStaticGLBuffer()
unsigned int GLuint
Definition MRGLStaticHolder.h:14
static MRVIEWER_API void freeAllShaders()
static MRVIEWER_API GLuint getShaderId(ShaderType type)
Definition MRRenderHelpers.h:64
Definition MRCameraOrientationPlugin.h:7