Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::FragmentListRenderer Class Reference

helper class for rendering perfect alpha-blended shapes using fragment lists. Inspiration taken from http://blog.icare3d.org/2010/07/opengl-40-abuffer-v20-linked-lists-of.html. It requires OpenGL 4.2. More...

#include <fragmentlistrenderer.h>

Classes

struct  IllustrationSettings
 

Public Member Functions

void prePass (const size2_t &screenSize)
 Starts the rendering of transparent objects using fragment lists. It resets all counters and allocated the index textures of the given screen size. This has to be called each frame before objects can be rendered with the fragment lists.
 
void setShaderUniforms (Shader &shader) const
 Sets the shader uniforms required by the fragment list renderer. The uniforms are defined in oit/abufferlinkedlist.glsl
 
bool postPass (bool useIllustration, const Image *background)
 Finishes the fragment list pass and renders the final result. This sorts the fragment lists per pixel and outputs the blended color.
 
void beginCount ()
 
void endCount ()
 
void setIllustrationSettings (const IllustrationSettings &settings)
 
DispatcherHandle< void()> onReload (std::function< void()> callback)
 
void debugFragmentLists (std::ostream &oss)
 
void debugIllustrationBuffer (std::ostream &oss)
 

Static Public Member Functions

static bool supportsFragmentLists ()
 Tests if fragment lists are supported by the current opengl context. Fragment lists require OpenGL 4.3.
 
static bool supportsIllustration ()
 Tests if the illustration buffer are supported and can therefore be enabled. The Illustration Buffer requires OpenGL 4.6 or OpenGL 4.5 with the extension "GL_ARB_shader_atomic_counter_ops".
 

Detailed Description

helper class for rendering perfect alpha-blended shapes using fragment lists. Inspiration taken from http://blog.icare3d.org/2010/07/opengl-40-abuffer-v20-linked-lists-of.html. It requires OpenGL 4.2.

Any objects can be rendered with this framework in the following way:

  1. Render opaque objects normally
  2. Call FragmentListRenderer::prePass(...)
  3. For each transparent object: a) Include oit/abufferlinkedlist.glsl in the fragment shader b) Use the following snipped in the fragment shader: abufferRender(ivec2(gl_FragCoord.xy), depth, fragColor); discard; c) Assign additional shader uniforms with FragmentListRenderer::setShaderUniforms(shader) d) Render the object with depth test but without depth write
  4. Call FragmentListRenderer::postPass(...) If this returns false, not enough space for all pixels was available. Repeat from step 2.

Member Function Documentation

◆ postPass()

bool inviwo::FragmentListRenderer::postPass ( bool useIllustration,
const Image * background )

Finishes the fragment list pass and renders the final result. This sorts the fragment lists per pixel and outputs the blended color.

Parameters
useIllustrationSet to true if the illustration buffer should be enabled
backgroundThe background to render on and use depth information from.
Returns
true if successfull, false if not enough space for all fragments was available and the procedure should be repeated.

◆ prePass()

void inviwo::FragmentListRenderer::prePass ( const size2_t & screenSize)

Starts the rendering of transparent objects using fragment lists. It resets all counters and allocated the index textures of the given screen size. This has to be called each frame before objects can be rendered with the fragment lists.

Parameters
screenSizethe current screen size

◆ setShaderUniforms()

void inviwo::FragmentListRenderer::setShaderUniforms ( Shader & shader) const

Sets the shader uniforms required by the fragment list renderer. The uniforms are defined in oit/abufferlinkedlist.glsl

Parameters
shaderthe shader of the object to be rendered

◆ supportsFragmentLists()

static bool inviwo::FragmentListRenderer::supportsFragmentLists ( )
static

Tests if fragment lists are supported by the current opengl context. Fragment lists require OpenGL 4.3.

Returns
true iff they are supported

◆ supportsIllustration()

static bool inviwo::FragmentListRenderer::supportsIllustration ( )
static

Tests if the illustration buffer are supported and can therefore be enabled. The Illustration Buffer requires OpenGL 4.6 or OpenGL 4.5 with the extension "GL_ARB_shader_atomic_counter_ops".

Returns
true iff they are supported

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