Class Framebuffer
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
OpenGL framebuffer object with color and depth attachments.
public class FramebufferInheritance
Derived
Constructors
Framebuffer(string)
Creates a new named OpenGL framebuffer object.
public Framebuffer(string name)Parameters
name string
Debug label applied to the framebuffer object.
Properties
ClearColor
Color used to clear the color attachment.
public Color4 ClearColor { get; set; }Property Value
ClearMask
Buffer bits cleared when is called.
public ClearBufferMask ClearMask { get; set; }Property Value
ClearBufferMask
Color
Color attachment texture, or null if none.
public RenderTexture? Color { get; protected set; }Property Value
ColorFormat
Pixel format specification for the color attachment.
public Framebuffer.AttachmentFormat? ColorFormat { get; protected set; }Property Value
Depth
Depth attachment texture, or null if none.
public RenderTexture? Depth { get; protected set; }Property Value
DepthFormat
Pixel format specification for the depth attachment.
public Framebuffer.DepthAttachmentFormat? DepthFormat { get; protected set; }Property Value
Framebuffer.DepthAttachmentFormat?
FboHandle
OpenGL framebuffer object handle.
public int FboHandle { get; }Property Value
GLDefaultFramebuffer
Creates a instance wrapping the default OpenGL framebuffer (handle 0).
public static Framebuffer GLDefaultFramebuffer { get; }Property Value
Height
Height of the framebuffer in pixels.
public int Height { get; protected set; }Property Value
InitialStatus
Framebuffer completeness status set after is called.
public FramebufferErrorCode InitialStatus { get; }Property Value
FramebufferErrorCode
NumMips
Number of mip levels for color attachments.
public int NumMips { get; set; }Property Value
NumSamples
Number of MSAA samples; 0 means no multisampling.
public int NumSamples { get; set; }Property Value
Stencil
Stencil view texture, or null if none.
public RenderTexture? Stencil { get; protected set; }Property Value
Target
Texture target used for attachments ( or ).
public TextureTarget Target { get; protected set; }Property Value
TextureTarget
TargetState
The framebuffer target this object was last bound to.
public FramebufferTarget TargetState { get; set; }Property Value
FramebufferTarget
Width
Width of the framebuffer in pixels.
public int Width { get; protected set; }Property Value
Methods
AttachColorMipLevel(int)
Attaches a specific mip level of the color texture to the color attachment point.
public void AttachColorMipLevel(int mipLevel)Parameters
mipLevel int
Zero-based mip level to attach.
Bind(FramebufferTarget)
Binds this framebuffer to the specified target.
public void Bind(FramebufferTarget targetState)Parameters
targetState FramebufferTarget
BindAndClear(FramebufferTarget)
Binds this framebuffer and clears it with and .
public void BindAndClear(FramebufferTarget targetState = FramebufferTarget.Framebuffer)Parameters
targetState FramebufferTarget
ChangeFormat(AttachmentFormat?, DepthAttachmentFormat?, FramebufferAttachment?)
Changes the attachment formats and recreates the GPU attachments at the current dimensions.
public void ChangeFormat(Framebuffer.AttachmentFormat? colorFormat, Framebuffer.DepthAttachmentFormat? depthFormat, FramebufferAttachment? framebufferAttachment = null)Parameters
colorFormat Framebuffer.AttachmentFormat?
depthFormat Framebuffer.DepthAttachmentFormat?
framebufferAttachment FramebufferAttachment?
CheckStatus_ThrowIfIncomplete(string)
Throws an if the framebuffer is not complete.
public void CheckStatus_ThrowIfIncomplete(string name = "")Parameters
name string
Delete()
Deletes the framebuffer object and all its attached textures.
public void Delete()Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)Parameters
obj object?
The object to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()Returns
A hash code for the current object.
GetMipSize(int)
Returns the pixel dimensions of the framebuffer at the given mip level.
public Vector2i GetMipSize(int level)Parameters
level int
Zero-based mip level.
Returns
HasValidDimensions()
Returns true if both and are greater than zero.
public bool HasValidDimensions()Returns
Initialize()
Allocates GPU textures for all attachments and checks framebuffer completeness.
public FramebufferErrorCode Initialize()Returns
FramebufferErrorCode
The OpenGL framebuffer completeness status code.
Prepare(string, int, int, int, AttachmentFormat?, DepthAttachmentFormat?)
Creates and configures a framebuffer without allocating GPU attachments; call to allocate.
public static Framebuffer Prepare(string name, int width, int height, int msaa, Framebuffer.AttachmentFormat? colorFormat, Framebuffer.DepthAttachmentFormat? depthFormat)Parameters
name string
Debug label for the framebuffer.
width int
Width in pixels.
height int
Height in pixels.
msaa int
Number of MSAA samples; 0 disables multisampling.
colorFormat Framebuffer.AttachmentFormat?
Color attachment format, or null for depth-only.
depthFormat Framebuffer.DepthAttachmentFormat?
Depth attachment format, or null for color-only.
Returns
Resize(int, int, int)
Resizes the framebuffer and changes the MSAA sample count, recreating attachments if anything changed.
public void Resize(int width, int height, int msaa)Parameters
width int
height int
msaa int
Resize(int, int)
Resizes the framebuffer, recreating attachments if dimensions changed.
public bool Resize(int width, int height)Parameters
width int
height int
Returns
true if the dimensions changed and attachments were recreated.
SetShadowDepthSamplerState(bool)
Configures depth comparison sampling on the depth attachment for shadow map reads.
public void SetShadowDepthSamplerState(bool lEqualCompare = false)Parameters
lEqualCompare bool
When true, sets a less-or-equal compare function; otherwise keeps the default.
Operators
operator ==(Framebuffer?, Framebuffer?)
Returns true if both framebuffers wrap the same OpenGL handle.
public static bool operator ==(Framebuffer? left, Framebuffer? right)Parameters
left Framebuffer?
right Framebuffer?
Returns
operator !=(Framebuffer?, Framebuffer?)
Returns true if the framebuffers wrap different OpenGL handles.
public static bool operator !=(Framebuffer? left, Framebuffer? right)Parameters
left Framebuffer?
right Framebuffer?

