Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
computeShaderTest.hpp
Go to the documentation of this file.
1 
23 #ifndef __COMPUTE__
24 #define __COMPUTE__
25 
26 #include <tucano/effect.hpp>
27 #include <tucano/framebuffer.hpp>
28 
29 using namespace std;
30 
34 class ComputeShaderTest : public Effect {
35 
36  public:
37 
39  ComputeShaderTest(const char* name, int currentWidth, int currentHeight): ssbo(0){
40 
41  effectName = name;
42  viewportSize = Eigen::Vector2i(currentWidth, currentHeight);
43 
44  }
45 
47  virtual void initialize();
48 
50  virtual void render(Mesh* mesh = NULL, Trackball* cameraTrackball = NULL, Trackball* lightTrackball = NULL);
51 
53  virtual void reloadShaders();
54 
55  Shader* getFirstPassShader() {
56  return firstPassShader;
57  }
58 
61 
62  if(firstPassShader) {
63  delete firstPassShader;
64  }
65 
66  if(shader) {
67  delete shader;
68  }
69 
70  if(thirdPassShader) {
71  delete thirdPassShader;
72  }
73 
74  }
75 
76  Shader* getShader() {
77  return shader;
78  }
79 
80  protected:
81 
83  void setOpenGLMatricesUniforms(Shader* currentShader, Trackball* cameraTrackball, Trackball* lightTrackball);
84 
86  void createSSBO();
87 
89  void createImage();
90 
92  Shader* firstPassShader;
93 
95  Shader* shader;
96 
98  Shader* thirdPassShader;
99 
101  Framebuffer* fbo;
102 
104  GLuint ssbo;
105 
107  GLuint finalImage;
108 
109 };
110 
111 #endif
Shader * getFirstPassShader()
Definition: computeShaderTest.hpp:55
ComputeShaderTest(const char *name, int currentWidth, int currentHeight)
Default Constructor:
Definition: computeShaderTest.hpp:39
Shader * firstPassShader
Shader used to offscreen rendering.
Definition: computeShaderTest.hpp:92
Definition: computeShaderTest.hpp:34
Framebuffer * fbo
Framebuffer.
Definition: computeShaderTest.hpp:101
~ComputeShaderTest()
Default destructor. Just deletes the shaders and destroy the buffers.
Definition: computeShaderTest.hpp:60
Shader * thirdPassShader
Shader used in back-buffer rendering.
Definition: computeShaderTest.hpp:98
GLuint finalImage
Image to store the compute shader manipulations.
Definition: computeShaderTest.hpp:107
Shader * shader
Compute shader.
Definition: computeShaderTest.hpp:95
GLuint ssbo
Shader Storage Buffer Object.
Definition: computeShaderTest.hpp:104
Shader * getShader()
Definition: computeShaderTest.hpp:76