Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
full_screen_effect.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2022 Inria
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of the ALICE Project-Team nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Contact: Bruno Levy
30  *
31  * https://www.inria.fr/fr/bruno-levy
32  *
33  * Inria,
34  * Domaine de Voluceau,
35  * 78150 Le Chesnay - Rocquencourt
36  * FRANCE
37  *
38  */
39 
40 #ifndef H_OGF_RENDERER_CONTEXT_FULL_SCREEN_EFFECT_H
41 #define H_OGF_RENDERER_CONTEXT_FULL_SCREEN_EFFECT_H
42 
44 #include <geogram_gfx/basic/GLSL.h>
46 #include <geogram/basic/counted.h>
47 
53 namespace GEO {
54 
64  public Counted, public GLSL::PseudoFileProvider {
65  public:
70 
75 
76 
84  virtual double required_GLSL_version() const;
85 
92  virtual void pre_render(index_t width, index_t height);
93 
101  virtual void post_render();
102 
109  virtual void update();
110 
117  index_t width() const {
118  return width_;
119  }
120 
127  index_t height() const {
128  return height_;
129  }
130 
139  bool OK() const {
140  return OK_;
141  }
142 
150  std::vector<GLSL::Source>& sources
151  );
152 
160  std::vector<GLSL::Source>& sources
161  );
162 
163  protected:
164 
172  virtual void initialize(index_t w, index_t h);
173 
181  virtual void resize(index_t w, index_t h);
182 
186  void reset_alpha();
187 
188  private:
189  bool initialized_;
190  bool OK_;
191  index_t width_;
192  index_t height_;
193 
194  protected:
195  FrameBufferObject draw_FBO_;
196  bool ES_profile_;
197  };
198 
203 
204 }
205 
206 #endif
Utilities for manipulating GLSL shaders.
Base class for reference-counted objects.
Definition: counted.h:71
An OpenGL frame buffer object.
Implementation of full screen effects.
virtual void get_fragment_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/fragment_shader_preamble....
void reset_alpha()
Resets alpha plane to 1.0 (opaque)
bool OK() const
Tests whether this FullScreenEffect can be used.
FullScreenEffectImpl()
FullScreenEffectImpl constructor.
virtual void get_vertex_shader_preamble_pseudo_file(std::vector< GLSL::Source > &sources)
Gets the content of the virtual file GLUP/current_profile/vertex_shader_preamble.h.
index_t width() const
Gets the width of the rendering context.
~FullScreenEffectImpl() override
FullScreenEffectImpl destructor.
index_t height() const
Gets the height of the rendering context.
virtual double required_GLSL_version() const
Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl.
virtual void resize(index_t w, index_t h)
Callback called whenever the rendering context is resized.
virtual void pre_render(index_t width, index_t height)
Callback called at the beginning of each frame.
virtual void update()
Callback called whenever parameters are changed in the GUI.
virtual void initialize(index_t w, index_t h)
Callback called the first time this FullScreenEffectImpl is used.
virtual void post_render()
Callback called at the end of each frame.
A class that can register functions to the GLSL pseudo file system.
Definition: GLSL.h:175
Base class of reference-counted objects, to be used with smart pointers.
Helper class for manipulating OpenGL frame buffer objects.
#define GEOGRAM_GFX_API
Linkage declaration for geogram symbols.
Definition: defs.h:55
Common include file, providing basic definitions. Should be included before anything else by all head...
Global Vorpaline namespace.
Definition: basic.h:55
SmartPointer< FullScreenEffectImpl > FullScreenEffectImpl_var
An automatic reference-counted pointer to a FullScreenEffectImpl.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329