Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/shader_data.h @ 10738

Last change on this file since 10738 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
RevLine 
[4838]1/*!
[9806]2 * @file shader_data.h
[5261]3 * @brief Definition of the Shader rendering class
[3245]4*/
[1853]5
[9806]6#ifndef _SHADER_DATA_H
7#define _SHADER_DATA_H
[1853]8
[3543]9#include "base_object.h"
[9806]10
[9818]11#include "glincl.h"
[7164]12#include <vector>
[9818]13#include "count_pointer.h"
[1853]14
[8037]15// FORWARD DECLARATION
16
17
18
[9806]19//! The ShaderData is a Class-wrapper around the OpenGL Shader Language (GLSL).
20class ShaderData : public BaseObject
[5261]21{
[9806]22  ObjectListDeclaration(ShaderData);
[9818]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;
[8037]33public:
[9818]34  ShaderData();
[9806]35  virtual ~ShaderData();
[5261]36
[9818]37  bool load(const std::string& vertexShaderFile = "", const std::string& fragmentShaderFile = "");
[5261]38
[9818]39
[9806]40  GLhandleARB getProgram() const { return this->shaderProgram; }
41  GLhandleARB getVertexS() const { return this->vertexShader; }
42  GLhandleARB getFragmentS() const { return this->fragmentShader; }
[3543]43
[9806]44  void activateShader();
[3543]45
[9806]46  void debug() const;
47private:
[8255]48  void bindShader(const char* name, const float* value, size_t size);
[9806]49  void linkShaderProgram();
50  bool readShader(const std::string& fileName, std::string& output);
[9818]51  bool loadShaderProgramm(ShaderData::Type type, const std::string& fileName);
52  void deleteProgram(ShaderData::Type type);
[5317]53
[9818]54  static void printError(GLhandleARB program);
55
[8037]56private:
[9818]57
[8037]58  std::string            fragmentShaderFile;
59  std::string            vertexShaderFile;
60
61  GLhandleARB            shaderProgram;
62
63  GLhandleARB            vertexShader;
64  GLhandleARB            fragmentShader;
[1853]65};
66
[9806]67#endif /* _SHADER_DATA_H */
Note: See TracBrowser for help on using the repository browser.