MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoShader/Inventor/misc/SoGLShader.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 
00006 
00007 
00008 #ifndef  _SO_GL_SHADER_
00009 #define  _SO_GL_SHADER_
00010 
00011 #include "SoShaderSystem.h"
00012 #include <Inventor/SbBasic.h>
00013 #ifdef MEVISLAB
00014 #include <mlOpenGL.h>
00015 #else
00016 #include <Inventor/system/SbOpenGL.h>
00017 #endif
00018 
00020 SoEXTENDER class INVENTOR_SHADER_API SoGLShader
00021 {
00022    public:
00023 
00025       static SbBool  isSupported();
00026       
00028       static void    printCapabilities();
00029 
00031       SbBool         isContextStillValid(int context) {
00032          return (_context == -1) || (_context == context);
00033       }
00034       
00035    SoINTERNAL public:
00036 
00038       int            getContext() const {
00039          return _context;
00040       }
00041 
00042    protected:
00043   
00045       SoGLShader();
00046       
00048       virtual ~SoGLShader() {}
00049       
00051       virtual void   reset();
00052 
00054       void           errClear(const char *string = NULL) const;
00056       void           errCheck(const char *string = NULL) const;
00058       inline SbBool  error(const char *string = NULL) const {
00059          errCheck(string); return _openGLError != GL_NO_ERROR;
00060       }
00061 
00062       GLuint         _programHandle;
00063 #ifndef MEVISLAB
00064 #define PROGRAMHANDLE (_programHandle)
00065 #endif
00066 
00068       int            _context;
00069 
00070    private:
00071       
00072       static int     _isSupported;
00073 
00074       mutable GLenum _openGLError;
00075 };
00076 
00077 #endif  // _SO_GL_SHADER_