Louvre  v1.2.1-2
C++ library for Wayland compositors
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
LFramebuffer Class Referenceabstract

#include <LFramebuffer.h>

Base class for creating framebuffers. More...

Detailed Description

Base class for creating framebuffers.

Note
This class is primarily intended for internal use by Louvre and may not be directly useful to you.

The LFramebuffer abstract class provides an interface for creating framebuffers or "groups of framebuffers" that can be used with LPainter.
Framebuffers serve as destinations where rendering can be performed and stored.

For example, each LOutput can have one, two, or more framebuffers (LOutputFramebuffer) that are displayed on screen, or each LSceneView also have its own framebuffer.

If you need to render into a framebuffer and then use it as a texture, consider using the LRenderBuffer class instead.

See also
LPainter::bindFramebuffer() for usage details.

Public Types

enum  Type
 
enum  Transform : Int32
 Enumeration for Framebuffer Transformations. More...
 

Public Member Functions

Type type () const
 
virtual ~LFramebuffer ()
 Destructor for the LFramebuffer class. More...
 
virtual Float32 scale () const =0
 Get the scale by which the framebuffer dimensions must be interpreted. More...
 
virtual const LSizesizeB () const =0
 Get the size of the framebuffer in buffer coordinates. More...
 
virtual const LRectrect () const =0
 Get the position and size of the framebuffer in surface coordinates. More...
 
virtual GLuint id () const =0
 Get the OpenGL framebuffer ID. More...
 
virtual Int32 buffersCount () const =0
 Get the number of framebuffers represented by this instance. More...
 
virtual Int32 currentBufferIndex () const =0
 Get the index of the framebuffer where the rendering is stored. More...
 
virtual const LTexturetexture (Int32 index=0) const =0
 Get the OpenGL texture ID of a specific framebuffer index. More...
 
virtual void setFramebufferDamage (const LRegion *damage)=0
 Set the damaged region. More...
 
virtual Transform transform () const =0
 Get the framebuffer transformation. More...
 
- Public Member Functions inherited from LObject
 LObject ()=default
 Constructor of the LObject class. More...
 
 ~LObject ()
 Destructor of the LObject class. More...
 
std::shared_ptr< const bool > isAlive () const
 Object's liveness status. More...
 

Static Public Member Functions

static bool is90Transform (Transform transform)
 
static Transform requiredTransform (Transform from, Transform to)
 
- Static Public Member Functions inherited from LObject
static LCompositorcompositor ()
 Quick access to the global compositor instance. More...
 
static LSeatseat ()
 Quick access to the global seat instance. More...
 
static LCursorcursor ()
 Quick access to the global cursor instance. More...
 

Protected Attributes

Type m_type
 

Member Enumeration Documentation

◆ Type

enum Type
Enumerator
Output 
Render 

◆ Transform

enum Transform : Int32

Enumeration for Framebuffer Transformations.

This enumeration defines different transformations that can be applied to a framebuffer. These transformations include rotations and flips for adjusting the orientation of the framebuffer.

Enumerator
Normal 

No transformation.

Rotated90 

Rotate 90 degrees counter-clockwise.

Rotated180 

Rotate 180 degrees counter-clockwise.

Rotated270 

Rotate 270 degrees counter-clockwise.

Flipped 

Flipped (swap left and right sides)

Flipped90 

Flip and rotate 90 degrees counter-clockwise.

Flipped180 

Flip and rotate 180 degrees counter-clockwise.

Flipped270 

Flip and rotate 270 degrees counter-clockwise.

Constructor & Destructor Documentation

◆ ~LFramebuffer()

virtual ~LFramebuffer ( )
inlinevirtual

Destructor for the LFramebuffer class.

Member Function Documentation

◆ type()

Type type ( ) const
inline

◆ is90Transform()

static bool is90Transform ( Transform  transform)
inlinestatic

◆ requiredTransform()

static Transform requiredTransform ( Transform  from,
Transform  to 
)
inlinestatic

◆ scale()

virtual Float32 scale ( ) const
pure virtual

Get the scale by which the framebuffer dimensions must be interpreted.

This method must return the scale factor used to interpret the dimensions of the framebuffer. For example, HiDPI pixmaps/displays may have a scale of 2, whereas low DPI pixmaps/displays may have a scale of 1.

Returns
The scale factor for the framebuffer.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ sizeB()

virtual const LSize& sizeB ( ) const
pure virtual

Get the size of the framebuffer in buffer coordinates.

This method must return the size of the framebuffer in buffer coordinates.

Returns
The size of the framebuffer in buffer coordinates.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ rect()

virtual const LRect& rect ( ) const
pure virtual

Get the position and size of the framebuffer in surface coordinates.

This method must return the position and size of the framebuffer in surface coordinates.

Returns
The rect representing the position and size of the framebuffer in surface coordinates.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ id()

virtual GLuint id ( ) const
pure virtual

Get the OpenGL framebuffer ID.

This method must return the current OpenGL framebuffer ID associated with the instance.

Returns
The OpenGL framebuffer ID.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ buffersCount()

virtual Int32 buffersCount ( ) const
pure virtual

Get the number of framebuffers represented by this instance.

This method must return the number of framebuffers represented by this instance.

Returns
The number of framebuffers.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ currentBufferIndex()

virtual Int32 currentBufferIndex ( ) const
pure virtual

Get the index of the framebuffer where the rendering is stored.

This method must return the index of the framebuffer where rendering must be performed/stored.

Returns
The index of the framebuffer used for rendering.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ texture()

virtual const LTexture* texture ( Int32  index = 0) const
pure virtual

Get the OpenGL texture ID of a specific framebuffer index.

This method must return the OpenGL texture ID associated with the specified framebuffer index.

Parameters
indexThe index of the framebuffer.
Returns
The OpenGL texture ID of the specified framebuffer index.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ setFramebufferDamage()

virtual void setFramebufferDamage ( const LRegion damage)
pure virtual

Set the damaged region.

This method sets the region in surface coordinates that indicates the parts of the framebuffer that have changed since the last painting was performed.

Parameters
damageA pointer to the LRegion object representing the changed region.

Implemented in LRenderBuffer, and LOutputFramebuffer.

◆ transform()

virtual Transform transform ( ) const
pure virtual

Get the framebuffer transformation.

This method must return the current framebuffer transformation applied.

Returns
The framebuffer transformation.

Implemented in LRenderBuffer, and LOutputFramebuffer.

Member Data Documentation

◆ m_type

Type m_type
protected