Class FrameBuffer


  • public class FrameBuffer
    extends Deletable
    Can contain multiple color buffers, but can only contain one depth and stencil buffer.
    • 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).
    • 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.
        Specified by:
        delete in class Deletable
      • 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.