WindowFramebuffer
extends AbstractFramebuffer
in package
The window frame buffer is the default framebuffer.
It is the framebuffer that is used when no other framebuffer is bound. To be able to provide a bit of abstraction, we create a class for it.
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
Methods
- __construct() : mixed
- Constructor
- bind() : bool
- Binds the framebuffer to the current context
- clear() : void
- Clears the framebuffer Note: This will bind the framebuffer to the current context!
- 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
Methods
__construct()
Constructor
public
final __construct(GLState $gl) : mixed
Parameters
- $gl : GLState
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
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