Louvre  v2.1.0-1
C++ library for Wayland compositors
Public Member Functions | List of all members
LRenderBuffer Class Referencefinal

Represents a custom render destination framebuffer. More...

+ Inheritance diagram for LRenderBuffer:

Public Member Functions

 LRenderBuffer (const LSize &sizeB, bool alpha=true) noexcept
 Constructor for LRenderBuffer with specified size. More...
 
 ~LRenderBuffer () noexcept
 Destructor for LRenderBuffer. More...
 
GLuint id () const noexcept override
 Retrieve the OpenGL ID of the framebuffer. More...
 
LTexturetexture (Int32 index=0) const noexcept override
 Retrieve the texture associated with the framebuffer. More...
 
void setSizeB (const LSize &sizeB) noexcept
 Set the size of the framebuffer in buffer coordinates. More...
 
const LSizesizeB () const noexcept override
 Retrieve the size of the framebuffer in buffer coordinates. More...
 
const LSizesize () const noexcept
 Retrieve the size of the framebuffer. More...
 
void setPos (const LPoint &pos) noexcept
 Set the position of the framebuffer. More...
 
const LPointpos () const noexcept
 Retrieve the position of the framebuffer. More...
 
const LRectrect () const noexcept override
 Retrieve the position and size of the framebuffer in surface coordinates. More...
 
void setScale (Float32 scale) noexcept
 Set the buffer scale to properly scale the rendered content. More...
 
Float32 scale () const noexcept override
 Gets the scale by which the framebuffer dimensions must be interpreted. More...
 
Int32 buffersCount () const noexcept override
 Gets the number of internal framebuffers. More...
 
Int32 currentBufferIndex () const noexcept override
 Gets the index of the current internal framebuffer. More...
 
void setFramebufferDamage (const LRegion *damage) noexcept override
 Set the damaged region. More...
 
LTransform transform () const noexcept override
 Gets the framebuffer transform. More...
 
- Public Member Functions inherited from LFramebuffer
Type type () const noexcept
 Gets the type of LFramebuffer. More...
 
- Public Member Functions inherited from LObject
 LObject (const LObject &) noexcept
 Copy constructor. More...
 
LObjectoperator= (const LObject &) noexcept
 Assignment operator (each object has its own individual LWeak reference count). More...
 
void setUserData (UIntPtr data) const noexcept
 Store an unsigned integer value/pointer. More...
 
UIntPtr userData () const noexcept
 Retrieves the stored unsigned integer value/pointer. More...
 

Additional Inherited Members

- Public Types inherited from LFramebuffer
enum  Type
 Types of framebuffer. More...
 
- Protected Member Functions inherited from LObject
 LObject () noexcept=default
 Constructor of the LObject class. More...
 
virtual ~LObject () noexcept
 Destructor of the LObject class. More...
 
void notifyDestruction () noexcept
 Notifies the object destruction. More...
 

Detailed Description

Represents a custom render destination framebuffer.

The LRenderBuffer provides a means to render to a framebuffer instead of an LOutput, allowing the resulting content to be used as a texture.
It can be employed with an LPainter via LPainter::bindFramebuffer().

Note
The framebuffer possesses properties such as position, size, and scale factor. These properties are utilized by LPainter to appropriately position and scale the rendered content.

Constructor & Destructor Documentation

◆ LRenderBuffer()

LRenderBuffer ( const LSize sizeB,
bool  alpha = true 
)
noexcept

Constructor for LRenderBuffer with specified size.

This constructor creates an LRenderBuffer with the specified size in buffer coordinates.

Parameters
sizeBThe size of the framebuffer in buffer coordinates.
alphaEmploy a format with an alpha component.

◆ ~LRenderBuffer()

~LRenderBuffer ( )
noexcept

Destructor for LRenderBuffer.

Member Function Documentation

◆ id()

GLuint id ( ) const
overridevirtualnoexcept

Retrieve the OpenGL ID of the framebuffer.

This method returns the OpenGL ID of the framebuffer associated with the LRenderBuffer.

Returns
The OpenGL ID of the framebuffer.

Implements LFramebuffer.

◆ texture()

LTexture * texture ( Int32  index = 0) const
overridevirtualnoexcept

Retrieve the texture associated with the framebuffer.

LRenderBuffers always have a single framebuffer, so 0 must always be passed as an argument. The index is part of the LFramebuffer parent class, which may be used by special framebuffers like those of LOutput.

Parameters
indexThe index of the texture (default is 0).
Returns
A pointer to the texture associated with the framebuffer.

Implements LFramebuffer.

◆ setSizeB()

void setSizeB ( const LSize sizeB)
noexcept

Set the size of the framebuffer in buffer coordinates.

Warning
The existing framebuffer is destroyed and replaced by a new one each time this method is called, so it should be used with moderation.
Parameters
sizeBThe new size of the framebuffer in buffer coordinates.

◆ sizeB()

const LSize & sizeB ( ) const
overridevirtualnoexcept

Retrieve the size of the framebuffer in buffer coordinates.

This method returns the size of the framebuffer in buffer coordinates.

Returns
The size of the framebuffer.

Implements LFramebuffer.

◆ size()

const LSize& size ( ) const
inlinenoexcept

Retrieve the size of the framebuffer.

This method returns the size of the framebuffer in surface coordinates. This is sizeB() / scale().

Returns
The size of the framebuffer.

◆ setPos()

void setPos ( const LPoint pos)
inlinenoexcept

Set the position of the framebuffer.

This method sets the position of the framebuffer in surface coordinates.

Parameters
posThe new position of the framebuffer.

◆ pos()

const LPoint& pos ( ) const
inlinenoexcept

Retrieve the position of the framebuffer.

This method returns the position of the framebuffer in surface coordinates.

Returns
The position of the framebuffer.

◆ rect()

const LRect & rect ( ) const
overridevirtualnoexcept

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

The size provided by this rect is equal to size().

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

Implements LFramebuffer.

◆ setScale()

void setScale ( Float32  scale)
inlinenoexcept

Set the buffer scale to properly scale the rendered content.

For example, framebuffers used in HiDPI displays should have a scale of 2 or greater.

Parameters
scaleThe buffer scale factor.

◆ scale()

Float32 scale ( ) const
overridevirtualnoexcept

Gets 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.

Implements LFramebuffer.

◆ buffersCount()

Int32 buffersCount ( ) const
overridevirtualnoexcept

Gets the number of internal framebuffers.

This method is used in implementations like LOutputFramebuffer, which may contain more than one internal framebuffer associated with an LFramebuffer, for example, when double or triple buffering is used.

Returns
The number of internal framebuffers.

Implements LFramebuffer.

◆ currentBufferIndex()

Int32 currentBufferIndex ( ) const
overridevirtualnoexcept

Gets the index of the current internal framebuffer.

This method must return the index of the current internal framebuffer (where the rendered content will be stored).

Returns
The index of the framebuffer used for rendering.

Implements LFramebuffer.

◆ setFramebufferDamage()

void setFramebufferDamage ( const LRegion damage)
overridevirtualnoexcept

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.

Implements LFramebuffer.

◆ transform()

LTransform transform ( ) const
overridevirtualnoexcept

Gets the framebuffer transform.

Implements LFramebuffer.