MeVisLab Resolution Independence API
Toggle main menu visibility
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
"
20
#include "
Inventor/misc/SoGLShader.h
"
21
#include "
Inventor/misc/SoShaderTypes.h
"
22
#include <Inventor/SbLinear.h>
23
#include <
mlGLResources.h
>
24
25
class
SoGLShaderProgram
;
26
28
class
INVENTOR_SHADER_API
SoGLShaderObject
:
public
SoGLShader
29
{
30
typedef
SoGLShader
inherited;
31
32
public
:
34
SoGLShaderObject
(
SoShader::ShaderType
shaderType
);
35
37
~SoGLShaderObject
()
override
;
38
40
void
reset
()
override
;
41
42
void
activate
(SbBool act);
43
SbBool
isActive
()
const
44
{
45
return
_isActive
;
46
}
47
48
SoShader::ShaderType
shaderType
()
const
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
73
SoINTERNAL public :
74
75
void
76
compile
();
77
78
void
scheduleCompile
()
79
{
80
_shouldCompile
= TRUE;
81
}
82
SbBool
shouldCompile
()
const
83
{
84
return
_shouldCompile
;
85
}
86
87
void
scheduleRebuild
()
88
{
89
_shaderProgram
=
nullptr
;
90
_shouldCompile
= TRUE;
91
}
92
93
SoGLShaderProgram
*
getShaderProgram
()
const
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
}
112
bool
alwaysReadErrorLog
()
113
{
114
return
_alwaysReadErrorLog
;
115
}
116
117
bool
hadCompileError
()
118
{
119
return
_hadError
;
120
}
121
const
SbString&
getErrorLog
()
122
{
123
return
_errorLog
;
124
}
125
126
void
setEmulateLegacyOpenGL
(
bool
flag);
127
128
protected
:
129
std::string
adaptSourceString
();
130
131
bool
_emulateLegacyOpenGL
;
132
133
SoShader::ShaderType
_shaderType
;
134
SbBool
_isActive
;
135
136
int
_version
;
137
138
SbString
_source
;
139
SbBool
_shouldCompile
;
140
141
SbString
_name
;
142
143
SoGLShaderProgram
*
_shaderProgram
;
144
145
ml::GLSLShader
_shaderRes
;
146
147
bool
_alwaysReadErrorLog
;
148
bool
_hadError
;
149
SbString
_errorLog
;
150
};
151
152
#endif
// _SO_GL_SHADER_OBJECT_
SoGLShader.h
SoShaderSystem.h
INVENTOR_SHADER_API
#define INVENTOR_SHADER_API
Define class export specifier.
Definition
SoShaderSystem.h:20
SoShaderTypes.h
SoGLShaderObject::getName
const SbString & getName() const
Definition
SoGLShaderObject.h:103
SoGLShaderObject::setSource
void setSource(const SbString &source)
SoGLShaderObject::_isActive
SbBool _isActive
Definition
SoGLShaderObject.h:134
SoGLShaderObject::_emulateLegacyOpenGL
bool _emulateLegacyOpenGL
Definition
SoGLShaderObject.h:131
SoGLShaderObject::scheduleRebuild
void scheduleRebuild()
Definition
SoGLShaderObject.h:87
SoGLShaderObject::isCreated
SbBool isCreated() const
Definition
SoGLShaderObject.h:68
SoGLShaderObject::scheduleCompile
void scheduleCompile()
Definition
SoGLShaderObject.h:78
SoGLShaderObject::version
int version() const
Get the used GLSL version (only available after compile()!).
Definition
SoGLShaderObject.h:63
SoGLShaderObject::_alwaysReadErrorLog
bool _alwaysReadErrorLog
Definition
SoGLShaderObject.h:147
SoGLShaderObject::_name
SbString _name
Definition
SoGLShaderObject.h:141
SoGLShaderObject::setName
void setName(const SbString &name)
Definition
SoGLShaderObject.h:98
SoGLShaderObject::reset
void reset() override
Free all resources (OpenGL too) and reset instance to initial state.
SoGLShaderObject::getShaderProgram
SoGLShaderProgram * getShaderProgram() const
Definition
SoGLShaderObject.h:93
SoGLShaderObject::_errorLog
SbString _errorLog
Definition
SoGLShaderObject.h:149
SoGLShaderObject::_version
int _version
Definition
SoGLShaderObject.h:136
SoGLShaderObject::attach
void attach(SoGLShaderProgram *shaderProgram)
SoGLShaderObject::setEmulateLegacyOpenGL
void setEmulateLegacyOpenGL(bool flag)
SoGLShaderObject::shaderType
SoShader::ShaderType shaderType() const
Definition
SoGLShaderObject.h:48
SoGLShaderObject::_shaderType
SoShader::ShaderType _shaderType
Definition
SoGLShaderObject.h:133
SoGLShaderObject::hadCompileError
bool hadCompileError()
Definition
SoGLShaderObject.h:117
SoGLShaderObject::getSource
const SbString & getSource() const
Definition
SoGLShaderObject.h:54
SoGLShaderObject::activate
void activate(SbBool act)
SoGLShaderObject::_shaderProgram
SoGLShaderProgram * _shaderProgram
Definition
SoGLShaderObject.h:143
SoGLShaderObject::_shouldCompile
SbBool _shouldCompile
Definition
SoGLShaderObject.h:139
SoGLShaderObject::_source
SbString _source
Definition
SoGLShaderObject.h:138
SoGLShaderObject::compile
void compile()
SoGLShaderObject::setAlwaysReadErrorLog
void setAlwaysReadErrorLog(bool flag)
Definition
SoGLShaderObject.h:108
SoGLShaderObject::detach
void detach()
SoGLShaderObject::SoGLShaderObject
SoGLShaderObject(SoShader::ShaderType shaderType)
Constructor.
SoGLShaderObject::adaptSourceString
std::string adaptSourceString()
SoGLShaderObject::_shaderRes
ml::GLSLShader _shaderRes
Definition
SoGLShaderObject.h:145
SoGLShaderObject::getErrorLog
const SbString & getErrorLog()
Definition
SoGLShaderObject.h:121
SoGLShaderObject::shouldCompile
SbBool shouldCompile() const
Definition
SoGLShaderObject.h:82
SoGLShaderObject::~SoGLShaderObject
~SoGLShaderObject() override
Destructor.
SoGLShaderObject::isActive
SbBool isActive() const
Definition
SoGLShaderObject.h:43
SoGLShaderObject::_hadError
bool _hadError
Definition
SoGLShaderObject.h:148
SoGLShaderObject::alwaysReadErrorLog
bool alwaysReadErrorLog()
Definition
SoGLShaderObject.h:112
SoGLShaderProgram
Class managing an OpenGL shader program.
Definition
SoGLShaderProgram.h:33
SoGLShader::SoGLShader
SoGLShader()
Constructor.
ml::GLSLShader
GLSL Shader resource.
Definition
mlGLResources.h:330
mlGLResources.h
SoShader::ShaderType
ShaderType
Definition
SoShaderTypes.h:24
MeVisLab
Standard
Sources
Inventor
SoShader
Inventor
misc
SoGLShaderObject.h
Generated by
1.18.0