opensurgsim
Program.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_PROGRAM_H
17 #define SURGSIM_GRAPHICS_PROGRAM_H
18 
19 #include <string>
20 #include "SurgSim/Framework/Accessible.h"
21 #include "SurgSim/Framework/Asset.h"
22 
23 namespace SurgSim
24 {
25 
26 namespace Framework
27 {
28 class Asset;
29 }
30 
31 namespace Graphics
32 {
33 
40 class Program : public Framework::Asset
41 {
42 public:
43 
45  virtual ~Program() = 0;
46 
48  virtual bool hasVertexShader() const = 0;
49 
51  virtual void clearVertexShader() = 0;
52 
56  virtual bool loadVertexShader(const std::string& filePath) = 0;
57 
60  virtual void setVertexShaderSource(const std::string& source) = 0;
61 
64  virtual bool getVertexShaderSource(std::string* source) const = 0;
65 
67  virtual bool hasGeometryShader() const = 0;
68 
70  virtual void clearGeometryShader() = 0;
71 
75  virtual bool loadGeometryShader(const std::string& filePath) = 0;
76 
79  virtual void setGeometryShaderSource(const std::string& source) = 0;
80 
83  virtual bool getGeometryShaderSource(std::string* source) const = 0;
84 
85 
87  virtual bool hasFragmentShader() const = 0;
88 
90  virtual void clearFragmentShader() = 0;
91 
95  virtual bool loadFragmentShader(const std::string& filePath) = 0;
96 
99  virtual void setFragmentShaderSource(const std::string& source) = 0;
100 
103  virtual bool getFragmentShaderSource(std::string* source) const = 0;
104 
106  virtual void clear()
107  {
108  clearVertexShader();
109  clearGeometryShader();
110  clearFragmentShader();
111  }
112 
118  virtual void setGlobalScope(bool val) = 0;
119 
122  virtual bool isGlobalScope() const = 0;
123 
124 };
125 
126 inline Program::~Program()
127 {
128 }
129 
130 }; // namespace Graphics
131 
132 }; // namespace SurgSim
133 
134 #endif // SURGSIM_GRAPHICS_PROGRAM_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
This class is used to facilitate file loading.
Definition: Asset.h:39
virtual void clear()
Clears the entire shader, returning to fixed-function pipeline.
Definition: Program.h:106
Base class that defines the interface for graphics programs.
Definition: Program.h:40