ScummVM API documentation
OpenGL::Framebuffer Class Referenceabstract

#include <framebuffer.h>

Inheritance diagram for OpenGL::Framebuffer:
OpenGL::Backbuffer OpenGL::RenderbufferTarget OpenGL::TextureTarget

Public Types

enum  BlendMode {
  kBlendModeDisabled, kBlendModeOpaque, kBlendModeTraditionalTransparency, kBlendModePremultipliedTransparency,
  kBlendModeAdditive, kBlendModeMaskAlphaAndInvertByColor
}
 
enum  CopyMask {
  kCopyMaskClearColor = (1 << 0), kCopyMaskBlendState = (1 << 1), kCopyMaskScissorState = (1 << 2), kCopyMaskScissorBox = (1 << 4),
  kCopyMaskAll
}
 

Public Member Functions

void setClearColor (GLfloat r, GLfloat g, GLfloat b, GLfloat a)
 
void enableBlend (BlendMode mode)
 
void enableScissorTest (bool enable)
 
void setScissorBox (GLint x, GLint y, GLsizei w, GLsizei h)
 
const Math::Matrix4 & getProjectionMatrix () const
 
void copyRenderStateFrom (const Framebuffer &other, uint copyMask)
 
virtual bool setSize (uint width, uint height)=0
 
void activate (Pipeline *pipeline)
 
void deactivate ()
 

Protected Member Functions

bool isActive () const
 
void applyViewport ()
 
void applyProjectionMatrix ()
 
virtual void activateInternal ()=0
 
virtual void deactivateInternal ()
 

Protected Attributes

GLint _viewport [4]
 
Math::Matrix4 _projectionMatrix
 

Detailed Description

Object describing a framebuffer OpenGL can render to.

Member Enumeration Documentation

◆ BlendMode

Enumerator
kBlendModeDisabled 

Newly drawn pixels overwrite the existing contents of the framebuffer without mixing with them.

kBlendModeOpaque 

Newly drawn pixels overwrite the existing contents of the framebuffer without mixing with them. Alpha channel is discarded.

kBlendModeTraditionalTransparency 

Newly drawn pixels mix with the framebuffer based on their alpha value for transparency.

kBlendModePremultipliedTransparency 

Newly drawn pixels mix with the framebuffer based on their alpha value for transparency.

Requires the image data being drawn to have its color values pre-multipled with the alpha value.

kBlendModeAdditive 

Newly drawn pixels add to the destination value.

kBlendModeMaskAlphaAndInvertByColor 

Newly drawn pixels mask out existing pixels based on the alpha value and add inversions of the pixels based on the color.

Member Function Documentation

◆ setClearColor()

void OpenGL::Framebuffer::setClearColor ( GLfloat  r,
GLfloat  g,
GLfloat  b,
GLfloat  a 
)

Set the clear color of the framebuffer.

◆ enableBlend()

void OpenGL::Framebuffer::enableBlend ( BlendMode  mode)

Enable/disable GL_BLEND.

◆ enableScissorTest()

void OpenGL::Framebuffer::enableScissorTest ( bool  enable)

Enable/disable GL_SCISSOR_TEST.

◆ setScissorBox()

void OpenGL::Framebuffer::setScissorBox ( GLint  x,
GLint  y,
GLsizei  w,
GLsizei  h 
)

Set scissor box dimensions.

◆ getProjectionMatrix()

const Math::Matrix4& OpenGL::Framebuffer::getProjectionMatrix ( ) const
inline

Obtain projection matrix of the framebuffer.

◆ copyRenderStateFrom()

void OpenGL::Framebuffer::copyRenderStateFrom ( const Framebuffer other,
uint  copyMask 
)

Copy rendering state from another framebuffer

◆ activateInternal()

virtual void OpenGL::Framebuffer::activateInternal ( )
protectedpure virtual

Activate framebuffer.

This is supposed to set all state associated with the framebuffer.

Implemented in OpenGL::TextureTarget, OpenGL::Backbuffer, and OpenGL::RenderbufferTarget.

◆ deactivateInternal()

virtual void OpenGL::Framebuffer::deactivateInternal ( )
inlineprotectedvirtual

Deactivate framebuffer.

This is supposed to make any cleanup required when unbinding the framebuffer.

◆ setSize()

virtual bool OpenGL::Framebuffer::setSize ( uint  width,
uint  height 
)
pure virtual

Set the size of the target buffer.

Implemented in OpenGL::TextureTarget, OpenGL::Backbuffer, and OpenGL::RenderbufferTarget.

◆ activate()

void OpenGL::Framebuffer::activate ( Pipeline pipeline)

Accessor to activate framebuffer for pipeline.

◆ deactivate()

void OpenGL::Framebuffer::deactivate ( )

Accessor to deactivate framebuffer from pipeline.


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