MultisampleFramebuffer

open class MultisampleFramebuffer(width: Int, height: Int, samples: Int) : Framebuffer

Framebuffer with a multisample color renderbuffer attached. Used as the surface-shape render target so triangle and line edges get MSAA coverage instead of binary 1-bit coverage; resolveTo then blits the result into a single-sample texture for sampling.

Only construct when Kgl.supportsMultisampleFBO is true.

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, samples: Int)

Functions

Link copied to clipboard
fun attachTexture(dc: DrawContext, texture: Texture, attachment: Int, textarget: Int = GL_TEXTURE_2D): Boolean

Attach a texture to the given FBO attachment point. The default textarget is GL_TEXTURE_2D; pass a specific cube-map face target (e.g. GL_TEXTURE_CUBE_MAP_POSITIVE_X) to attach a face of a cube-map texture. The same cube-map texture can be re-attached to the same FBO multiple times with different faces to render into all six faces of one cube map without rebinding the FBO.

Link copied to clipboard
Link copied to clipboard
fun getAttachedTexture(attachment: Int): Texture
Link copied to clipboard

Underlying GL framebuffer name. Created lazily on first access.

Link copied to clipboard
Link copied to clipboard
open override fun release(dc: DrawContext)

Frees any resources associated with this instance. After this method returns the rendering resource is invalid, and any associated GL object is deleted.

Link copied to clipboard

Resolves this multisample framebuffer's color contents into dest's color attachment via glBlitFramebuffer. dest must be a single-sample framebuffer with the same width × height and the same color internal format (GL_RGBA8).