Framebuffer
extends AbstractFramebuffer
in package
Table of Contents
Properties
- $clearColor : Vec4
- Framebuffers clearing color
- $id : int
- OpenGL framebuffer ID
- $gl : GLState
- GL State instance as we modify the GL state
- $renderbufferAttachments : array<int, int>
- An array of renderbuffet attachments
Methods
- __construct() : mixed
- Creates a new framebuffer object
- __destruct() : mixed
- Destructor
- bind() : bool
- Binds the framebuffer to the current context
- clear() : void
- Clears the framebuffer Note: This will bind the framebuffer to the current context!
- createRenderbufferAttachment() : void
- Creates a render buffer attachent
- getFramebufferStatusString() : string
- Returns the given framebuffer status as string
- getStatus() : int
- Returns the current framebuffer statsus Note: This will bind the framebuffer to the current context!
- isValid() : bool
- Performs a status check on the framebuffer and returns boolean result.
Properties
$clearColor
Framebuffers clearing color
public
Vec4
$clearColor
$id read-only
OpenGL framebuffer ID
public
int
$id
$gl
GL State instance as we modify the GL state
protected
GLState
$gl
$renderbufferAttachments
An array of renderbuffet attachments
private
array<int, int>
$renderbufferAttachments
= []
maps: attachment -> render buffer object
Methods
__construct()
Creates a new framebuffer object
public
final __construct(GLState $gl) : mixed
Parameters
- $gl : GLState
__destruct()
Destructor
public
final __destruct() : mixed
bind()
Binds the framebuffer to the current context
public
bind([FramebufferTarget $target = FramebufferTarget::READ_DRAW ]) : bool
Parameters
- $target : FramebufferTarget = FramebufferTarget::READ_DRAW
-
Specifies the target to which the framebuffer is bound.
Return values
bool —Returns true if the framebuffer was bound, false if it was already bound
clear()
Clears the framebuffer Note: This will bind the framebuffer to the current context!
public
clear([int $clearbits = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ]) : void
Parameters
- $clearbits : int = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT
createRenderbufferAttachment()
Creates a render buffer attachent
public
createRenderbufferAttachment(int $format, int $attachment, int $width, int $height) : void
Parameters
- $format : int
- $attachment : int
- $width : int
- $height : int
getFramebufferStatusString()
Returns the given framebuffer status as string
public
getFramebufferStatusString(int $status) : string
Parameters
- $status : int
Return values
stringgetStatus()
Returns the current framebuffer statsus Note: This will bind the framebuffer to the current context!
public
getStatus() : int
Status can be one of:
- GL_FRAMEBUFFER_COMPLETE
- GL_FRAMEBUFFER_UNDEFINED
- GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
- GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
- GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
- GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
- GL_FRAMEBUFFER_UNSUPPORTED
- GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
- GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
Return values
intisValid()
Performs a status check on the framebuffer and returns boolean result.
public
isValid([int &$status = null ][, string &$error = null ]) : bool
If you wan't to get the error code and or message, the first two parameters are passed by reference.
Parameters
- $status : int = null
- $error : string = null