Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
REGLImage Class Referencefinal

Wraps an EGLImage imported from a dma-buf, exposing it to the OpenGL backend. More...

#include <REGLImage.h>

+ Inheritance diagram for REGLImage:

Public Member Functions

RGLTexture texture () const noexcept
 Returns a GL texture bound to this EGLImage (created lazily).
 
GLuint fb () const noexcept
 Returns a GL framebuffer (renderbuffer-backed by this EGLImage), created lazily per device.
 
EGLImage eglImage () const noexcept
 The underlying EGLImage handle.
 
RGLDevicedevice () const noexcept
 The device this EGLImage was created on.
 
- Public Member Functions inherited from RObject
 RObject ()=default
 Constructs a default RObject.
 

Static Public Member Functions

static std::shared_ptr< REGLImageMakeFromDMA (const RDMABufferInfo &info, RGLDevice *device=nullptr) noexcept
 Imports info as an EGLImage on device (or the main device if null).
 

Detailed Description

Wraps an EGLImage imported from a dma-buf, exposing it to the OpenGL backend.

Created from an RDMABufferInfo via eglCreateImageKHR (EGL_LINUX_DMA_BUF_EXT), it can be bound as a GL texture (GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES depending on the format's render support) or as a renderbuffer-backed framebuffer. The GL texture/framebuffer objects are created lazily and per-device (via the context-data manager).

Member Function Documentation

◆ MakeFromDMA()

static std::shared_ptr< REGLImage > MakeFromDMA ( const RDMABufferInfo info,
RGLDevice device = nullptr 
)
staticnoexcept

Imports info as an EGLImage on device (or the main device if null).

The plane fds are dup'd internally, so ownership is not taken. Returns nullptr if the format/modifier is unsupported or eglCreateImageKHR fails.

◆ texture()

RGLTexture texture ( ) const
noexcept

Returns a GL texture bound to this EGLImage (created lazily).

Returns
The texture, with id == 0 on failure.

◆ fb()

GLuint fb ( ) const
noexcept

Returns a GL framebuffer (renderbuffer-backed by this EGLImage), created lazily per device.

Returns
The framebuffer id, or 0 on failure.

◆ eglImage()

EGLImage eglImage ( ) const
inlinenoexcept

The underlying EGLImage handle.

◆ device()

RGLDevice * device ( ) const
inlinenoexcept

The device this EGLImage was created on.