VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGlShader.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 #pragma once
6 
10 
13 
15 
16 #include <vector>
17 #include <string>
18 
19 namespace makVrv
20 {
23  {
24  private:
26  DtGlShader();
27 
29  DtGlShader(const DtGlShader&);
30 
32  DtGlShader& operator=(const DtGlShader&);
33 
34  public:
36  {
37  VERTEX_SHADER = 0,
42  COMPUTE_SHADER
43  };
44 
47  static std::string loadShaderSource(const std::string& strFileName);
48 
50  static void saveShaderSource(const std::string& strFileName, const std::string& strSource);
51 
53  static std::string fixVersionDirective(const std::string &shaderString);
54 
56  static void deleteShaders(const std::vector<unsigned int>& shaderVector);
57 
61  static bool compileShader(const std::string& shader_name, const std::string& source, DtGlShaderType shaderType, unsigned int &shaderID);
62 
64  DtGlShader(const std::string& name, const std::string& source, DtGlShaderType type);
65 
67  ~DtGlShader();
68 
70  bool isValid() const;
71 
73  unsigned int id() const;
74 
75  protected:
76  unsigned int myShaderID;
77  bool myIsValid;
78  };
79 
81  typedef std::vector<DtGlShader*> DtShaderVector;
82 
85  {
86  private:
88  DtGlProgram();
89 
91  DtGlProgram(const DtGlProgram&);
92 
94  DtGlProgram& operator=(const DtGlProgram&);
95 
96  public:
101  static bool createProgram(const std::string& name, const VectorUnsignedInts& shaders, unsigned int& id);
102 
104  DtGlProgram(const std::string& name, const DtShaderVector& shaders);
105 
107  ~DtGlProgram();
108 
110  void bind();
111 
113  void unbind();
114 
116  bool isValid() const;
117 
119  unsigned int id() const;
120 
121  protected:
122  unsigned myProgramID;
123  bool myIsValid;
125  };
126 }
127 

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)