Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/shader.h @ 5322

Last change on this file since 5322 was 5319, checked in by bensch, 19 years ago

orxonox/trunk: some minor file-handling

File size: 1.5 KB
Line 
1/*!
2 * @file shader.h
3 * @brief Definition of the Shader rendering class
4*/
5
6#ifndef _SHADER_H
7#define _SHADER_H
8
9#include "base_object.h"
10#include "glincl.h"
11
12template<class T> class Array;
13
14typedef enum
15{
16  SHADER_NONE       = 0,
17  SHADER_FRAGMENT   = 1,
18  SHADER_VERTEX     = 0,
19
20} SHADER_TYPE;
21
22// FORWARD DECLARATION
23
24
25//! A class for ...
26class Shader : public BaseObject {
27
28 public:
29  Shader(const char* vertexShaderFile = NULL, const char* fragmentShaderFile = NULL);
30  virtual ~Shader();
31
32  bool loadShaderProgramm(SHADER_TYPE type, const char* fileName);
33  void activateShader();
34  static void deactivateShader();
35  void deleteProgram(SHADER_TYPE type);
36
37  char* fileRead(const char* fileName);
38  Array<char*>* fileReadArray(const char* fileName);
39
40  static bool checkShaderAbility();
41
42  inline static bool shaderActive() { return (Shader::storedShader != NULL)?true:false; };
43  inline static void suspendShader() { Shader* currShader = storedShader; if (storedShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} };
44  inline static void restoreShader() { if (storedShader != NULL) storedShader->activateShader(); storedShader = NULL; };
45
46
47  void printError(GLhandleARB program);
48  void debug() const;
49
50  private:
51
52 private:
53   char*                  fragmentShaderFile;
54   char*                  vertexShaderFile;
55   GLhandleARB            shaderProgram;
56   GLhandleARB            vertexShader;
57   GLhandleARB            fragmentShader;
58
59   static Shader*         storedShader;
60};
61
62#endif /* _SHADER_H */
Note: See TracBrowser for help on using the repository browser.