Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5968 was 5390, checked in by bensch, 19 years ago

orxonox/trunk: renamed Array to tArray

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