MeshLib C++ Docs
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;
51
53 MRVIEWER_API static GLuint getShaderId( ShaderType type );
54
56 MRVIEWER_API static void freeShader( ShaderType type );
57
59 MRVIEWER_API static void freeAllShaders();
60
62 MRVIEWER_API static RenderObjectBuffer& getStaticGLBuffer();
63
66
69
72
73private:
76
77 static GLStaticHolder& instance_();
78
79 void createShader_( ShaderType type );
80
81 std::array<GLuint, size_t( Count )> shadersIds_;
82
83 // it is stored here to prolong its life till this destructor
84 std::shared_ptr<spdlog::logger> logger_;
85
86 RenderObjectBuffer glBuffer_;
87};
88}
Definition MRGLStaticHolder.h:12
ShaderType
Definition MRGLStaticHolder.h:16
@ Picker
Definition MRGLStaticHolder.h:18
@ Mesh
Definition MRGLStaticHolder.h:17
@ Volume
Definition MRGLStaticHolder.h:47
@ Points
Definition MRGLStaticHolder.h:23
@ DepthPeelMesh
Definition MRGLStaticHolder.h:21
@ DepthPeelPoints
Definition MRGLStaticHolder.h:25
@ LinesPicker
Definition MRGLStaticHolder.h:29
@ AlphaSortMesh
Definition MRGLStaticHolder.h:20
@ ViewportBorder
Definition MRGLStaticHolder.h:41
@ Labels
Definition MRGLStaticHolder.h:35
@ SimpleOverlayQuad
Definition MRGLStaticHolder.h:44
@ AdditionalQuad
Definition MRGLStaticHolder.h:40
@ ShadowOverlayQuad
Definition MRGLStaticHolder.h:43
@ AdditionalPointsNoOffset
Definition MRGLStaticHolder.h:39
@ VolumePicker
Definition MRGLStaticHolder.h:48
@ MeshDesktopPicker
Definition MRGLStaticHolder.h:19
@ AdditionalPoints
Definition MRGLStaticHolder.h:38
@ AlphaSortLines
Definition MRGLStaticHolder.h:32
@ DepthPeelLines
Definition MRGLStaticHolder.h:33
@ DepthOverlayQuad
Definition MRGLStaticHolder.h:45
@ LinesJoint
Definition MRGLStaticHolder.h:28
@ AlphaSortPoints
Definition MRGLStaticHolder.h:24
@ AdditionalLines
Definition MRGLStaticHolder.h:37
@ LinesJointPicker
Definition MRGLStaticHolder.h:30
@ AlphaSortOverlayQuad
Definition MRGLStaticHolder.h:42
@ Lines
Definition MRGLStaticHolder.h:27
static MRVIEWER_API ShaderType getTransparentMeshShader(TransparencyMode m)
Returns the shader to render transparent mesh in the given mode.
static MRVIEWER_API void freeShader(ShaderType type)
Free shader from GL.
static MRVIEWER_API RenderObjectBuffer & getStaticGLBuffer()
Memory buffer for objects that about to be loaded to GPU, shared among different data types.
static MRVIEWER_API ShaderType getTransparentPointsShader(TransparencyMode m)
Returns the shader to render transparent points in the given mode.
unsigned int GLuint
Definition MRGLStaticHolder.h:14
static MRVIEWER_API ShaderType getTransparentLinesShader(TransparencyMode m)
Returns the shader to render transparent lines in the given mode.
static MRVIEWER_API void freeAllShaders()
Free all shaders from GL.
static MRVIEWER_API GLuint getShaderId(ShaderType type)
Creates shader if it is not and return valid id.
Definition MRRenderHelpers.h:64
Definition MRCameraOrientationPlugin.h:8
struct to determine transparent rendering mode
Definition MRRenderModelParameters.h:10