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

OpenGL representation of an Image as a framebuffer. More...

#include <imagegl.h>

+ Inheritance diagram for inviwo::ImageGL:

Public Types

using ActiveState
 

Public Member Functions

 ImageGL (const ImageGL &rhs)
 
virtual ImageGLclone () const override
 
ActiveState activate (ImageType imageType=ImageType::AllLayers)
 Store the current "state" and activate the FBO.
 
void activateBuffer (ImageType imageType=ImageType::AllLayers)
 Active the FBO.
 
void deactivateBuffer ()
 Deactivate the framebuffer (bind 0)
 
virtual size2_t getDimensions () const override
 
virtual bool copyRepresentationsTo (ImageRepresentation *target) const override
 Copies this instance into the target using a copy shader.
 
virtual size_t priority () const override
 
bool copyRepresentationsTo (ImageGL *target) const
 Copies this instance into the target using a copy shader.
 
bool updateFrom (const ImageGL *source)
 Copies source into this instance using Blitting and PBOs if needed.
 
FrameBufferObjectgetFBO ()
 
const FrameBufferObjectgetFBO () const
 
LayerGLgetLayerGL (LayerType, size_t idx=0)
 
const LayerGLgetLayerGL (LayerType, size_t idx=0) const
 
LayerGLgetColorLayerGL (size_t idx=0)
 
LayerGLgetDepthLayerGL ()
 
LayerGLgetPickingLayerGL ()
 
const LayerGLgetColorLayerGL (size_t idx=0) const
 
const LayerGLgetDepthLayerGL () const
 
const LayerGLgetPickingLayerGL () const
 
size_t getNumberOfColorLayers () const
 
GLenum getPickingAttachmentID () const
 
virtual dvec4 readPixel (size2_t pos, LayerType layer, size_t index=0) const override
 
virtual std::type_index getTypeIndex () const override final
 
virtual bool isValid () const override
 
virtual void update (bool editable) override
 
- Public Member Functions inherited from inviwo::ImageRepresentation
 ImageRepresentation (const ImageRepresentation &rhs)=default
 
ImageRepresentationoperator= (const ImageRepresentation &that)=default
 
virtual void setOwner (Image *image) override
 
virtual ImagegetOwner () override
 
virtual const ImagegetOwner () const override
 
- Public Member Functions inherited from inviwo::DataGroupRepresentation< Image >

Additional Inherited Members

- Protected Member Functions inherited from inviwo::DataGroupRepresentation< Image >
 DataGroupRepresentation (const DataGroupRepresentation &rhs)=default
 
DataGroupRepresentationoperator= (const DataGroupRepresentation &that)=default
 
- Protected Attributes inherited from inviwo::ImageRepresentation
Imageowner_ = nullptr
 

Detailed Description

OpenGL representation of an Image as a framebuffer.

Handles attaching all the image layers to the framebuffer

See also
Image, ImageRepresentation

Member Typedef Documentation

◆ ActiveState

using inviwo::ImageGL::ActiveState
Initial value:
std::tuple<utilgl::ActivateFBO, utilgl::GlBoolState, utilgl::DepthMaskState,
utilgl::ViewportState>
SimpleState< GLboolean, GLboolean, GL_DEPTH_WRITEMASK, glGetBooleanv, glDepthMask > DepthMaskState
RAII object for OpenGL depth mask to enable/disable writing depth.
Definition openglutils.h:543

Member Function Documentation

◆ activate()

ActiveState inviwo::ImageGL::activate ( ImageType imageType = ImageType::AllLayers)

Store the current "state" and activate the FBO.

Stores the currently bound FBO, the current depth test, depth mask, and viewport. Binds the framebuffer. Sets the draw buffers. Color layer 0 will be at location 0, if picking is included in the imageType the picking layer will be at location 1. Any additional layers will be at the following locations. If imageType contains depth the depth test is enabled and the depth mask is set to true, otherwise the depth test is disabled and the depth mask is set to false. Finally the viewport is the to the image dimensions.

Parameters
imageTypeThe layers that should be active.
Returns
An RAII object that will restore the old state on destruction.

◆ activateBuffer()

void inviwo::ImageGL::activateBuffer ( ImageType imageType = ImageType::AllLayers)

Active the FBO.

Binds the framebuffer, and set the draw buffers. Color layer 0 will be at location 0, if picking is included in the imageType the picking layer will be at location 1. Any additional layers will be at the following locations. If imageType contains depth the depth test is enabled and the depth mask is set to true, otherwise the depth test is disabled and the depth mask is set to false. Finally the viewport is the to the image dimensions.

Note
In the case of nested calls where the state needs to be maintained
See also
activate(ImageType)
Parameters
imageTypeThe layers that should be active.

◆ clone()

virtual ImageGL * inviwo::ImageGL::clone ( ) const
overridevirtual

◆ copyRepresentationsTo() [1/2]

bool inviwo::ImageGL::copyRepresentationsTo ( ImageGL * target) const

Copies this instance into the target using a copy shader.

The image content is scaled to the target dimensions. If the aspects are different the target image will get padding to preserve the aspect of the source content.

Parameters
targetimage to copy into.
Returns
true

◆ copyRepresentationsTo() [2/2]

virtual bool inviwo::ImageGL::copyRepresentationsTo ( ImageRepresentation * target) const
overridevirtual

Copies this instance into the target using a copy shader.

The image content is scaled to the target dimensions. If the aspects are different the target image will get padding to preserve the aspect of the source content.

Parameters
targetimage to copy into.
Returns
true

Implements inviwo::ImageRepresentation.

◆ getDimensions()

virtual size2_t inviwo::ImageGL::getDimensions ( ) const
overridevirtual

◆ getTypeIndex()

virtual std::type_index inviwo::ImageGL::getTypeIndex ( ) const
finaloverridevirtual

◆ isValid()

virtual bool inviwo::ImageGL::isValid ( ) const
overridevirtual

◆ priority()

virtual size_t inviwo::ImageGL::priority ( ) const
overridevirtual

Returns a number representing the general efficiency of the representation. Larger value means more efficient representation. Used for selection which representation to operate on when resizing for example.

Implements inviwo::ImageRepresentation.

◆ readPixel()

virtual dvec4 inviwo::ImageGL::readPixel ( size2_t pos,
LayerType layer,
size_t index = 0 ) const
overridevirtual

Read a single pixel value out of the specified layer at pos. Should only be used to read single values not entire images.

Implements inviwo::ImageRepresentation.

◆ update()

virtual void inviwo::ImageGL::update ( bool editable)
overridevirtual

◆ updateFrom()

bool inviwo::ImageGL::updateFrom ( const ImageGL * source)

Copies source into this instance using Blitting and PBOs if needed.

Does not care about aspect ratios, copies the source image into the this instance using "nearest" interpolation. If some layers are not attached to the FBO they will be copied using PBO instead.

Parameters
sourceImage to copy from
Returns
true

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