Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::FullScreenEffectImpl Class Reference

Implementation of full screen effects. More...

#include <geogram_gfx/full_screen_effects/full_screen_effect.h>

Inheritance diagram for GEO::FullScreenEffectImpl:
GEO::Counted GEO::GLSL::PseudoFileProvider GEO::AmbientOcclusionImpl GEO::UnsharpMaskingImpl

Public Member Functions

 FullScreenEffectImpl ()
 FullScreenEffectImpl constructor.
 
 ~FullScreenEffectImpl () override
 FullScreenEffectImpl destructor.
 
virtual double required_GLSL_version () const
 Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl. More...
 
virtual void pre_render (index_t width, index_t height)
 Callback called at the beginning of each frame. More...
 
virtual void post_render ()
 Callback called at the end of each frame. More...
 
virtual void update ()
 Callback called whenever parameters are changed in the GUI. More...
 
index_t width () const
 Gets the width of the rendering context. More...
 
index_t height () const
 Gets the height of the rendering context. More...
 
bool OK () const
 Tests whether this FullScreenEffect can be used. More...
 
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. More...
 
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.h. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 
- Public Member Functions inherited from GEO::GLSL::PseudoFileProvider
virtual ~PseudoFileProvider ()
 PseudoFileProvider destructor.
 

Protected Member Functions

virtual void initialize (index_t w, index_t h)
 Callback called the first time this FullScreenEffectImpl is used. More...
 
virtual void resize (index_t w, index_t h)
 Callback called whenever the rendering context is resized. More...
 
void reset_alpha ()
 Resets alpha plane to 1.0 (opaque)
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Protected Attributes

FrameBufferObject draw_FBO_
 
bool ES_profile_
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Detailed Description

Implementation of full screen effects.

This is the low-level class for full screen effects, that communicates with the RenderingContext and with OpenGL. In Graphite, typically a full screen effect is implemented as a pair of FullScreenEffectImpl / FullScreenEffect.

Definition at line 63 of file full_screen_effect.h.

Member Function Documentation

◆ get_fragment_shader_preamble_pseudo_file()

virtual void GEO::FullScreenEffectImpl::get_fragment_shader_preamble_pseudo_file ( std::vector< GLSL::Source > &  sources)
virtual

Gets the content of the virtual file GLUP/current_profile/fragment_shader_preamble.h.

Parameters
[in,out]sourceswhere the content of the virtual file should be appended

◆ get_vertex_shader_preamble_pseudo_file()

virtual void GEO::FullScreenEffectImpl::get_vertex_shader_preamble_pseudo_file ( std::vector< GLSL::Source > &  sources)
virtual

Gets the content of the virtual file GLUP/current_profile/vertex_shader_preamble.h.

Parameters
[in,out]sourceswhere the content of the virtual file should be appended

◆ height()

index_t GEO::FullScreenEffectImpl::height ( ) const
inline

Gets the height of the rendering context.

We cache the size of the rendering context, it is used for instance to create FrameBufferObjects.

Returns
The height of the rendering context, in pixels.

Definition at line 127 of file full_screen_effect.h.

◆ initialize()

virtual void GEO::FullScreenEffectImpl::initialize ( index_t  w,
index_t  h 
)
protectedvirtual

Callback called the first time this FullScreenEffectImpl is used.

Parameters
[in]w,hwidth and height of the rendering context.

Subclasses may overload this callback. The OpenGL context is properly bound when this function is called.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ OK()

bool GEO::FullScreenEffectImpl::OK ( ) const
inline

Tests whether this FullScreenEffect can be used.

Most full screen effects require some hardware support, this function tests whether the GPU has sufficient functionalities for implementing this FullScreenEffect.

Return values
trueif it can be used
falseotherwise

Definition at line 139 of file full_screen_effect.h.

◆ post_render()

virtual void GEO::FullScreenEffectImpl::post_render ( )
virtual

Callback called at the end of each frame.

Subclasses may overload this function, and use it to transfered the content of FrameBufferObjects to the screen. Baseclass implementation copies the contents of draw_FBO_ to the screen.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ pre_render()

virtual void GEO::FullScreenEffectImpl::pre_render ( index_t  width,
index_t  height 
)
virtual

Callback called at the beginning of each frame.

Parameters
[in]width,heightdimension of the rendering context.

Baseclass implementation redirects rendering to draw_FBO_.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ required_GLSL_version()

virtual double GEO::FullScreenEffectImpl::required_GLSL_version ( ) const
virtual

Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl.

Default implementation returns 1.0.

Returns
the minimum required GLSL version as a double precision floating point number.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ resize()

virtual void GEO::FullScreenEffectImpl::resize ( index_t  w,
index_t  h 
)
protectedvirtual

Callback called whenever the rendering context is resized.

Subclasses may overload this callback, for instance to resize FrameBufferObject.

Parameters
[in]w,hnew width and height of the rendering context, in pixels.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ update()

virtual void GEO::FullScreenEffectImpl::update ( )
virtual

Callback called whenever parameters are changed in the GUI.

Subclasses may overload this function, and use it to transfer parameters to shader uniforms.

Reimplemented in GEO::UnsharpMaskingImpl, and GEO::AmbientOcclusionImpl.

◆ width()

index_t GEO::FullScreenEffectImpl::width ( ) const
inline

Gets the width of the rendering context.

We cache the size of the rendering context, it is used for instance to create FrameBufferObjects.

Returns
The width of the rendering context, in pixels.

Definition at line 117 of file full_screen_effect.h.


The documentation for this class was generated from the following file: