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

Wrapper for a native OpenGL framebuffer. More...

+ Inheritance diagram for LFramebufferWrapper:

Public Member Functions

 LFramebufferWrapper (GLuint id, const LSize &sizeB, const LPoint &pos=LPoint(0, 0), Float32 scale=1.f) noexcept
 Constructs an LGLFramebuffer object. More...
 
void setId (GLuint id) noexcept
 Sets the ID of the native OpenGL framebuffer. More...
 
void setSizeB (const LSize &sizeB) noexcept
 Sets the buffer size of the framebuffer. More...
 
void setScale (Float32 scale) noexcept
 Sets the scaling factor of the framebuffer. More...
 
void setPos (const LPoint &pos) noexcept
 Sets the position of the framebuffer in the global compositor-coordinates space. More...
 
Float32 scale () const noexcept override
 Gets the scale by which the framebuffer dimensions must be interpreted. More...
 
const LSizesizeB () const noexcept override
 Gets the size of the framebuffer in buffer coordinates. More...
 
const LRectrect () const noexcept override
 Gets the position and size of the framebuffer in surface coordinates. More...
 
GLuint id () const noexcept override
 Gets the OpenGL framebuffer ID. 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...
 
LTexturetexture (Int32) const noexcept override
 Gets the OpenGL texture ID of a specific framebuffer index. More...
 
void setFramebufferDamage (const LRegion *) noexcept override
 Set the damaged region. More...
 
virtual 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

Wrapper for a native OpenGL framebuffer.

This class facilitates the usage of an existing native OpenGL framebuffer with LPainter.
It requires providing the framebuffer ID, its buffer size, scaling factor and position.

Note
Native OpenGL framebuffers are not shared across threads, and thus cannot be utilized from all LOutputs.
If a framebuffer is needed for use from any thread, consider using LRenderBuffer instead.

Constructor & Destructor Documentation

◆ LFramebufferWrapper()

LFramebufferWrapper ( GLuint  id,
const LSize sizeB,
const LPoint pos = LPoint(0,0),
Float32  scale = 1.f 
)
inlinenoexcept

Constructs an LGLFramebuffer object.

Parameters
idThe ID of the native OpenGL framebuffer.
sizeBThe buffer size of the framebuffer.
posThe position of the framebuffer in the global compositor-coordinates space.
scaleThe scaling factor of the framebuffer (default is 1.0).

Member Function Documentation

◆ setId()

void setId ( GLuint  id)
inlinenoexcept

Sets the ID of the native OpenGL framebuffer.

Parameters
idThe ID of the framebuffer.

◆ setSizeB()

void setSizeB ( const LSize sizeB)
inlinenoexcept

Sets the buffer size of the framebuffer.

Parameters
sizeBThe buffer size.

◆ setScale()

void setScale ( Float32  scale)
inlinenoexcept

Sets the scaling factor of the framebuffer.

Parameters
scaleThe scaling factor.

◆ setPos()

void setPos ( const LPoint pos)
inlinenoexcept

Sets the position of the framebuffer in the global compositor-coordinates space.

Parameters
posThe position.

◆ scale()

Float32 scale ( ) const
inlineoverridevirtualnoexcept

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.

◆ sizeB()

const LSize& sizeB ( ) const
inlineoverridevirtualnoexcept

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

Implements LFramebuffer.

◆ rect()

const LRect& rect ( ) const
inlineoverridevirtualnoexcept

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

Implements LFramebuffer.

◆ id()

GLuint id ( ) const
inlineoverridevirtualnoexcept

Gets the OpenGL framebuffer ID.

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

Returns
The OpenGL framebuffer ID.

Implements LFramebuffer.

◆ buffersCount()

Int32 buffersCount ( ) const
inlineoverridevirtualnoexcept

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
inlineoverridevirtualnoexcept

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.

◆ texture()

LTexture* texture ( Int32  index) const
inlineoverridevirtualnoexcept

Gets the OpenGL texture ID of a specific framebuffer index.

This method must return the OpenGL texture ID associated with the specified framebuffer index or 0 if not available.

Parameters
indexThe index of the framebuffer.
Returns
The OpenGL texture ID of the specified framebuffer index or 0 if not available.

Implements LFramebuffer.

◆ setFramebufferDamage()

void setFramebufferDamage ( const LRegion damage)
inlineoverridevirtualnoexcept

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()

virtual LTransform transform ( ) const
inlineoverridevirtualnoexcept

Gets the framebuffer transform.

Implements LFramebuffer.