Class FrameBuffer
- java.lang.Object
-
- com.github.ranchordo.lepton.engine.util.Deletable
-
- com.github.ranchordo.lepton.engine.rendering.FrameBuffer
-
public class FrameBuffer extends Deletable
Can contain multiple color buffers, but can only contain one depth and stencil buffer.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEPTHBUFFER
static int
FRAMEBUFFER
static int
TEXTUREBUFFER
-
Constructor Summary
Constructors Constructor Description FrameBuffer(int ms)
ms is multisample.FrameBuffer(int ms, int ntbo, int format)
ms is multisample for MSAA (MultiSample AntiAliasing, used to remove jagged edges).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind()
Bind this such that stuff renders to it.void
bindDepthTexture(int binding)
Bind dbo to a texture on texture unit "binding".void
bindImage(int id)
Bind tbos[id] as an image.void
bindImage(int id, int rwmode, int unit)
Bind tbos[id] as an image to image unit "unit".void
bindTexture(int id)
Bind tbos[id] to a texture.void
bindTexture(int id, int binding)
Bind tbos[id] to a texture on texture unit "binding".void
blitTo(FrameBuffer buffer)
Blit (AKA copy) this framebuffer to another (this.tbos[0] to target.tbos[0]).void
blitTo(FrameBuffer buffer, int id)
Blit (AKA copy) this framebuffer to another (this.tbos[id] to target.tbos[0]).void
blitTo(FrameBuffer buffer, int id, int targID)
Blit (AKA copy) this framebuffer to another (this.tbos[id] to target.tbos[targID]).void
delete()
Clean up this framebuffer from memory.int
getID(int id, int secID)
Get an int-style pointer to the framebuffer, renderbuffer, or texturebuffer object.int[]
getTBOs()
void
setNumTexBuffers(int ntbo)
void
unbind()
static void
unbind_all()
-
-
-
Field Detail
-
FRAMEBUFFER
public static final int FRAMEBUFFER
- See Also:
- Constant Field Values
-
DEPTHBUFFER
public static final int DEPTHBUFFER
- See Also:
- Constant Field Values
-
TEXTUREBUFFER
public static final int TEXTUREBUFFER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FrameBuffer
public FrameBuffer(int ms)
ms is multisample. For MSAA (MultiSample AntiAliasing, used to remove jagged edges).
-
FrameBuffer
public FrameBuffer(int ms, int ntbo, int format)
ms is multisample for MSAA (MultiSample AntiAliasing, used to remove jagged edges). ntbo is the Number of TBOs. Format is the storage format. Defaults to GL_RGBA16F. Other useful ones are GL_RGBA8
-
-
Method Detail
-
getID
public int getID(int id, int secID)
Get an int-style pointer to the framebuffer, renderbuffer, or texturebuffer object. id can either be FRAMEBUFFER, RENDERBUFFER, or TEXTUREBUFFER. secID can be anything unless you're fetching TEXTUREBUFFER, in which case it is the index of the texturebuffer you want to access.
-
setNumTexBuffers
public void setNumTexBuffers(int ntbo)
-
getTBOs
public int[] getTBOs()
-
delete
public void delete()
Clean up this framebuffer from memory.
-
bindTexture
public void bindTexture(int id)
Bind tbos[id] to a texture.
-
bindTexture
public void bindTexture(int id, int binding)
Bind tbos[id] to a texture on texture unit "binding".
-
bindDepthTexture
public void bindDepthTexture(int binding)
Bind dbo to a texture on texture unit "binding".
-
blitTo
public void blitTo(FrameBuffer buffer)
Blit (AKA copy) this framebuffer to another (this.tbos[0] to target.tbos[0]).
-
blitTo
public void blitTo(FrameBuffer buffer, int id)
Blit (AKA copy) this framebuffer to another (this.tbos[id] to target.tbos[0]).
-
blitTo
public void blitTo(FrameBuffer buffer, int id, int targID)
Blit (AKA copy) this framebuffer to another (this.tbos[id] to target.tbos[targID]).
-
bind
public void bind()
Bind this such that stuff renders to it.
-
unbind_all
public static void unbind_all()
-
unbind
public void unbind()
-
bindImage
public void bindImage(int id)
Bind tbos[id] as an image. Useful for compute shaders.
-
bindImage
public void bindImage(int id, int rwmode, int unit)
Bind tbos[id] as an image to image unit "unit". Useful for compute shaders. rwmode is GL_READ_WRITE, GL_WRITE_ONLY, and GL_READ_ONLY.
-
-