MeVisLab Resolution Independence API
Loading...
Searching...
No Matches
SoGLShaderObject.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef SO_GLSHADER_OBJECT_H
14#define SO_GLSHADER_OBJECT_H
15
16
18
19#include "SoShaderSystem.h"
22#include <Inventor/SbLinear.h>
23#include <mlGLResources.h>
24
26
29{
30 typedef SoGLShader inherited;
31
32public:
35
38
40 void reset() override;
41
42 void activate(SbBool act);
43 SbBool isActive() const
44 {
45 return _isActive;
46 }
47
49 {
50 return _shaderType;
51 }
52
53 void setSource(const SbString& source);
54 const SbString& getSource() const
55 {
56 return _source;
57 }
58
59 void attach(SoGLShaderProgram* shaderProgram);
60 void detach();
61
63 int version() const
64 {
65 return _version;
66 }
67
68 SbBool isCreated() const
69 {
70 return _shaderRes.isValid();
71 }
72
73SoINTERNAL public :
74
75 void
77
79 {
80 _shouldCompile = TRUE;
81 }
82 SbBool shouldCompile() const
83 {
84 return _shouldCompile;
85 }
86
88 {
89 _shaderProgram = nullptr;
90 _shouldCompile = TRUE;
91 }
92
94 {
95 return _shaderProgram;
96 }
97
98 void setName(const SbString& name)
99 {
100 _name = name;
101 }
102
103 const SbString& getName() const
104 {
105 return _name;
106 }
107
108 void setAlwaysReadErrorLog(bool flag)
109 {
110 _alwaysReadErrorLog = flag;
111 }
113 {
114 return _alwaysReadErrorLog;
115 }
116
118 {
119 return _hadError;
120 }
121 const SbString& getErrorLog()
122 {
123 return _errorLog;
124 }
125
126 void setEmulateLegacyOpenGL(bool flag);
127
128protected:
129 std::string adaptSourceString();
130
132
134 SbBool _isActive;
135
137
138 SbString _source;
140
141 SbString _name;
142
144
146
149 SbString _errorLog;
150};
151
152#endif // _SO_GL_SHADER_OBJECT_
#define INVENTOR_SHADER_API
Define class export specifier.
const SbString & getName() const
void setSource(const SbString &source)
SbBool isCreated() const
int version() const
Get the used GLSL version (only available after compile()!).
void setName(const SbString &name)
void reset() override
Free all resources (OpenGL too) and reset instance to initial state.
SoGLShaderProgram * getShaderProgram() const
void attach(SoGLShaderProgram *shaderProgram)
void setEmulateLegacyOpenGL(bool flag)
SoShader::ShaderType shaderType() const
SoShader::ShaderType _shaderType
const SbString & getSource() const
void activate(SbBool act)
SoGLShaderProgram * _shaderProgram
void setAlwaysReadErrorLog(bool flag)
SoGLShaderObject(SoShader::ShaderType shaderType)
Constructor.
std::string adaptSourceString()
ml::GLSLShader _shaderRes
const SbString & getErrorLog()
SbBool shouldCompile() const
~SoGLShaderObject() override
Destructor.
SbBool isActive() const
Class managing an OpenGL shader program.
SoGLShader()
Constructor.
GLSL Shader resource.