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>
|
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 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".
|
|
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:
- Render opaque objects normally
- Call FragmentListRenderer::prePass(...)
- 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
- Call FragmentListRenderer::postPass(...) If this returns
false
, not enough space for all pixels was available. Repeat from step 2.
◆ 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
-
useIllustration | Set to true if the illustration buffer should be enabled |
background | The 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
-
screenSize | the 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
-
shader | the 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: