Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/test/src/lib/graphics/shader_data.h @ 10616

Last change on this file since 10616 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.7 KB
Line 
1/*!
2 * @file shader_data.h
3 * @brief Definition of the Shader rendering class
4*/
5
6#ifndef _SHADER_DATA_H
7#define _SHADER_DATA_H
8
9#include "base_object.h"
10
11#include "glincl.h"
12#include <vector>
13#include "count_pointer.h"
14
15// FORWARD DECLARATION
16
17
18
19//! The ShaderData is a Class-wrapper around the OpenGL Shader Language (GLSL).
20class ShaderData : public BaseObject
21{
22  ObjectListDeclaration(ShaderData);
23  //! The Type of Shader.
24  typedef enum  {
25    None       = 0,     //!< No Type at all
26    Fragment   = 1,     //!< Fragment Shader.
27    Vertex     = 2,     //!< Vertex Shader.
28    Program    = 4,     //!< Compiled Shader Programm.
29  }  Type;
30
31 public:
32  typedef CountPointer<ShaderData> Pointer;
33public:
34  ShaderData();
35  virtual ~ShaderData();
36
37  bool load(const std::string& vertexShaderFile = "", const std::string& fragmentShaderFile = "");
38
39
40  GLhandleARB getProgram() const { return this->shaderProgram; }
41  GLhandleARB getVertexS() const { return this->vertexShader; }
42  GLhandleARB getFragmentS() const { return this->fragmentShader; }
43
44  void activateShader();
45
46  void debug() const;
47private:
48  void bindShader(const char* name, const float* value, size_t size);
49  void linkShaderProgram();
50  bool readShader(const std::string& fileName, std::string& output);
51  bool loadShaderProgramm(ShaderData::Type type, const std::string& fileName);
52  void deleteProgram(ShaderData::Type type);
53
54  static void printError(GLhandleARB program);
55
56private:
57
58  std::string            fragmentShaderFile;
59  std::string            vertexShaderFile;
60
61  GLhandleARB            shaderProgram;
62
63  GLhandleARB            vertexShader;
64  GLhandleARB            fragmentShader;
65};
66
67#endif /* _SHADER_DATA_H */
Note: See TracBrowser for help on using the repository browser.