KWin
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
KWin::GLFramebuffer Class Reference

OpenGL framebuffer object. More...

#include <glframebuffer.h>

Public Types

enum  Attachment { NoAttachment , CombinedDepthStencil }
 

Public Member Functions

 GLFramebuffer ()
 
 GLFramebuffer (GLTexture *colorAttachment, Attachment attachment=NoAttachment)
 
 GLFramebuffer (GLuint handle, const QSize &size)
 
 ~GLFramebuffer ()
 
GLuint handle () const
 
QSize size () const
 
bool valid () const
 
void blitFromFramebuffer (const QRect &source=QRect(), const QRect &destination=QRect(), GLenum filter=GL_LINEAR, bool flipX=false, bool flipY=false)
 
bool blitFromRenderTarget (const RenderTarget &sourceRenderTarget, const RenderViewport &sourceViewport, const QRect &source, const QRect &destination)
 
GLTexturecolorAttachment () const
 

Static Public Member Functions

static void initStatic ()
 
static bool supported ()
 
static GLFramebuffercurrentFramebuffer ()
 
static void pushFramebuffer (GLFramebuffer *fbo)
 
static GLFramebufferpopFramebuffer ()
 
static bool blitSupported ()
 

Protected Member Functions

void initColorAttachment (GLTexture *colorAttachment)
 
void initDepthStencilAttachment ()
 

Friends

void KWin::cleanupGL ()
 

Detailed Description

OpenGL framebuffer object.

Framebuffer object enables you to render onto a texture. This texture can later be used to e.g. do post-processing of the scene.

Author
Rivo Laks rivol.nosp@m.aks@.nosp@m.hot.e.nosp@m.e

Definition at line 36 of file glframebuffer.h.

Member Enumeration Documentation

◆ Attachment

Enumerator
NoAttachment 
CombinedDepthStencil 

Definition at line 39 of file glframebuffer.h.

Constructor & Destructor Documentation

◆ GLFramebuffer() [1/3]

KWin::GLFramebuffer::GLFramebuffer ( )
explicit

Constructs a GLFramebuffer

Since
5.13

Definition at line 71 of file glframebuffer.cpp.

◆ GLFramebuffer() [2/3]

KWin::GLFramebuffer::GLFramebuffer ( GLTexture * colorAttachment,
Attachment attachment = NoAttachment )
explicit

Constructs a GLFramebuffer. Note that ensuring the color attachment outlives the framebuffer is the responsibility of the caller.

Parameters
colorAttachmenttexture where the scene will be rendered onto

Definition at line 108 of file glframebuffer.cpp.

◆ GLFramebuffer() [3/3]

KWin::GLFramebuffer::GLFramebuffer ( GLuint handle,
const QSize & size )

Constructs a wrapper for an already created framebuffer object. The GLFramebuffer does not take the ownership of the framebuffer object handle.

Definition at line 143 of file glframebuffer.cpp.

◆ ~GLFramebuffer()

KWin::GLFramebuffer::~GLFramebuffer ( )

Definition at line 152 of file glframebuffer.cpp.

Member Function Documentation

◆ blitFromFramebuffer()

void KWin::GLFramebuffer::blitFromFramebuffer ( const QRect & source = QRect(),
const QRect & destination = QRect(),
GLenum filter = GL_LINEAR,
bool flipX = false,
bool flipY = false )

Blits from source rectangle in the current framebuffer to the destination rectangle in this framebuffer.

Be aware that framebuffer blitting may not be supported on all hardware. Use blitSupported() to check whether it is supported.

The source and the destination rectangles can have different sizes. The filter indicates what filter will be used in case scaling needs to be performed.

See also
blitSupported
Since
4.8

Definition at line 246 of file glframebuffer.cpp.

◆ blitFromRenderTarget()

bool KWin::GLFramebuffer::blitFromRenderTarget ( const RenderTarget & sourceRenderTarget,
const RenderViewport & sourceViewport,
const QRect & source,
const QRect & destination )

Blits from source rectangle in logical coordinates in the current framebuffer to the destination rectangle in texture-local coordinates in this framebuffer, taking into account any transformations the source render target may have

Definition at line 282 of file glframebuffer.cpp.

◆ blitSupported()

bool KWin::GLFramebuffer::blitSupported ( )
static

Whether the GL_EXT_framebuffer_blit extension is supported. This functionality is not available in OpenGL ES 2.0.

Returns
whether framebuffer blitting is supported.
Since
4.8

Definition at line 43 of file glframebuffer.cpp.

◆ colorAttachment()

GLTexture * KWin::GLFramebuffer::colorAttachment ( ) const
Returns
the color attachment of this fbo. May be nullptr

Definition at line 318 of file glframebuffer.cpp.

◆ currentFramebuffer()

GLFramebuffer * KWin::GLFramebuffer::currentFramebuffer ( )
static

Returns the last bound framebuffer, or null if no framebuffer is current.

Definition at line 48 of file glframebuffer.cpp.

◆ handle()

GLuint KWin::GLFramebuffer::handle ( ) const
inline

Returns the framebuffer object handle to this framebuffer object.

Definition at line 68 of file glframebuffer.h.

◆ initColorAttachment()

void KWin::GLFramebuffer::initColorAttachment ( GLTexture * colorAttachment)
protected

Definition at line 178 of file glframebuffer.cpp.

◆ initDepthStencilAttachment()

void KWin::GLFramebuffer::initDepthStencilAttachment ( )
protected

Definition at line 184 of file glframebuffer.cpp.

◆ initStatic()

void KWin::GLFramebuffer::initStatic ( )
static

Definition at line 22 of file glframebuffer.cpp.

◆ popFramebuffer()

GLFramebuffer * KWin::GLFramebuffer::popFramebuffer ( )
static

Definition at line 59 of file glframebuffer.cpp.

◆ pushFramebuffer()

void KWin::GLFramebuffer::pushFramebuffer ( GLFramebuffer * fbo)
static

Definition at line 53 of file glframebuffer.cpp.

◆ size()

QSize KWin::GLFramebuffer::size ( ) const
inline

Returns the size of the color attachment to this framebuffer object.

Definition at line 75 of file glframebuffer.h.

◆ supported()

static bool KWin::GLFramebuffer::supported ( )
inlinestatic

Definition at line 85 of file glframebuffer.h.

◆ valid()

bool KWin::GLFramebuffer::valid ( ) const
inline

Definition at line 79 of file glframebuffer.h.

Friends And Related Symbol Documentation

◆ KWin::cleanupGL

void KWin::cleanupGL ( )
friend

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