VR-Forces 4.8 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) 2020 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 {
21  class DtGlTexture;
22 
25  {
26  public:
28  {
29  VERTEX_SHADER = 0,
34  COMPUTE_SHADER
35  };
36  public:
38  DtGlShader(const std::string& name, const std::string& source, DtGlShaderType type);
39 
41  virtual ~DtGlShader();
42  private:
44  DtGlShader();
45 
47  DtGlShader(const DtGlShader&);
48 
50  DtGlShader& operator=(const DtGlShader&);
51  public:
53  virtual bool isValid() const;
54 
56  virtual unsigned int id() const;
57  public:
60  static std::string loadShaderSource(const std::string& strFileName);
61 
63  static void saveShaderSource(const std::string& strFileName, const std::string& strSource);
64 
66  static std::string fixVersionDirective(const std::string &shaderString);
67 
69  static void deleteShaders(const std::vector<unsigned int>& shaderVector);
70 
74  static bool compileShader(const std::string& shader_name, const std::string& source, DtGlShaderType shaderType, unsigned int &shaderID);
75  protected:
76  unsigned int myShaderID;
77  bool myIsValid;
78  };
79 
81  typedef std::vector<DtGlShader*> DtShaderVector;
82 
85  {
86  public:
88  DtGlProgram(const std::string& name, const DtShaderVector& shaders);
89 
91  virtual ~DtGlProgram();
92  private:
94  DtGlProgram();
95 
97  DtGlProgram(const DtGlProgram&);
98 
100  DtGlProgram& operator=(const DtGlProgram&);
101  public:
102 
104  virtual void bind();
105 
107  virtual void unbind();
108 
110  virtual bool isValid() const;
111 
113  virtual unsigned int id() const;
114  public:
119  static bool createProgram(const std::string& name, const VectorUnsignedInts& shaders, unsigned int& id);
120 
125  static bool createComputeProgram(unsigned int& id, const std::string& source, const std::string& prefixName);
126 
131  static void runComputeShader(unsigned int computeProgram, unsigned int workSizeX, unsigned int workSizeY, bool bind);
132 
137  static void runComputeShader(unsigned int computeProgram, const DtGlTexture* renderTexture, bool bind);
138  protected:
139  unsigned myProgramID;
140  bool myIsValid;
142  };
143 }
144 
Dll export defines.
A convenience class to represent an OpenGL Shader.
Definition: DtGlShader.h:24
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlShader.h:84
std::vector< DtGlShader * > DtShaderVector
a list of shaders
Definition: DtGlShader.h:81
const DtShaderVector myShaders
Definition: DtGlShader.h:141
binderNoArgs< _Fn > bind(const _Fn &_Func, const _Ty &_Left)
Definition: DtSTLUtilities.h:76
Definition: DtGlShader.h:31
unsigned myProgramID
Definition: DtGlShader.h:139
DtGlShaderType
Definition: DtGlShader.h:27
const char * source
Definition: lz4.h:436
Enumerations for various types of texture/buffer formats.
unsigned int myShaderID
Definition: DtGlShader.h:76
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
Definition: DtGlShader.h:32
bool myIsValid
Definition: DtGlShader.h:77
Definition: DtGlShader.h:33
std::vector< unsigned int > VectorUnsignedInts
Definition: DtCommonTypes.h:19
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlTexture.h:20
Definition: DtGlShader.h:30
bool myIsValid
Definition: DtGlShader.h:140

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)