MeVisLab Toolbox Reference
SoGLShader.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_H
14#define SO_GLSHADER_H
15
16
18
19#include "SoShaderSystem.h"
20#include <Inventor/SbBasic.h>
21#include <mlOpenGL.h>
22
24#define SOSHADER_CORE_GLSL_VERSION 140
25
28{
29 public:
30
33
36
38 static void printCapabilities();
39
40 protected:
41
44
46 virtual ~SoGLShader() {}
47
49 virtual void reset();
50
52 void errClear(const char *string = nullptr) const;
54 void errCheck(const char *string = nullptr) const;
56 inline SbBool error(const char *string = nullptr) const {
57 errCheck(string); return _openGLError != GL_NO_ERROR;
58 }
59
60 private:
61
62 static int _isSupported;
63
64 mutable GLenum _openGLError;
65};
66
67#endif // _SO_GL_SHADER_
Abstract base class for shader objects.
Definition SoGLShader.h:28
virtual ~SoGLShader()
Destructor.
Definition SoGLShader.h:46
void errCheck(const char *string=nullptr) const
Check for OpenGL errors and print error message if one is found.
static bool supportsGeometryShaders()
Returns if the hardware supports geometry shaders.
static void printCapabilities()
Prints capabilities of the OpenGL implementation.
SbBool error(const char *string=nullptr) const
Returns 'TRUE' if OpenGL error is found.
Definition SoGLShader.h:56
virtual void reset()
Free all resources (OpenGL too) and reset instance to initial state.
void errClear(const char *string=nullptr) const
Clear OpenGL error state and print any previously not displayed error message.
SoGLShader()
Constructor.
static SbBool isSupported()
Returns 'TRUE' if vertex and fragment shaders are supported by OpenGL.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.