Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GLProjectionOutputAttachment.hh
1 #ifndef GLPROJECTION_OUTPUT_ATTACHMENT_HH_
2 #define GLPROJECTION_OUTPUT_ATTACHMENT_HH_
3 #include <bias_config.h>
4 
5 #ifndef BIAS_HAVE_OPENGL
6 # error You need BIAS with USE_OpenGL Please recompile BIAS.
7 #endif // BUILD_GLviewer
8 
9 #include <Gui/biasgl.h>
10 #include <Base/Debug/Debug.hh>
11 #include <GLviewer/Scenes/SceneBase.hh>
12 //#include <GLviewer/SceneBGImage.hh>
13 #include <OpenGLFramework/Base/glfCommon.hh>
14 #include <OpenGLFramework/Base/glfShader.hh>
15 #include <OpenGLFramework/Base/glfShaderProgram.hh>
16 #include <OpenGLFramework/Base/glfFramebufferObject.hh>
17 #include <OpenGLFramework/Base/glfRenderTarget.hh>
18 #include <OpenGLFramework/Base/glfTexture2D.hh>
19 
20 namespace BIAS {
21 
22  /**
23  * @brief Class for extra rendering pass in GLProjection (for now only used in glutGLviewer)
24  *
25  * GLProjection will first render into FBO of this attachment and afterwards
26  * the attached shader program is executed on the result.
27  * See OutputHaze, OutputWowDisplay for examples on how to derive specialized versions
28  * @ingroup g_glviewer
29  * @author fkellner
30  */
31  class BIASGLviewer_EXPORT GLProjectionOutputAttachment : public BIAS::Debug {
32  public:
33 
34  // identificators for glviewer
36  WoWVX = 0,
40  LensDistortion
41  };
42 
43  /// constructor is given final render target (GLProjection defaults to "screen")
46 
47  /// used by GLProjection to find rendering target of first pass
49 
50  return &(specialDisplayRenderingFBO_);
51  }
52 
53  /// rendering second pass (for example to "screen"
54  int Draw();
55 
56  /// can be called to create output attachment without having to derive new subclass
57  /// will also create FBO and attached textures. gl viewport information has to be already set up here.
58  int InitShader(std::string vertexCode, std::string fragmentCode);
59 
60  void SetClearColor(const BIAS::Vector4<float>& cc);
61 
62  protected:
63  virtual int InitShader_() { return -1;};
64  virtual int Draw_() { return StandardDraw_();};
65  /// this function suffices for simple shaders that only need the standard uniforms to be set.
66  /// these are one texture attachment, one depth attachment (the first pass render result), and their width and height
67  int StandardDraw_();
68 
71  BIAS::glfTexture2D specialDisplayTex_, specialDisplayDepth_;
76 
78  };
79 
80 }
81 
82 
83 #endif
84 
A 2D texture.
Definition: glfTexture2D.hh:40
A shader program composed of several shaders.
A GLSL vertex shader or fragment shader, which must be linked in a shader program.
Definition: glfShader.hh:39
BIAS::glfFramebufferObject specialDisplayRenderingFBO_
BIAS::glfFramebufferObject * GetOutputFBO()
used by GLProjection to find rendering target of first pass
Class for extra rendering pass in GLProjection (for now only used in glutGLviewer) ...
Interface for render targets.