Class FrameBufferCubemap

java.lang.Object
arc.graphics.gl.GLFrameBuffer<Cubemap>
arc.graphics.gl.FrameBufferCubemap
All Implemented Interfaces:
Disposable

public class FrameBufferCubemap extends GLFrameBuffer<Cubemap>

Encapsulates OpenGL ES 2.0 frame buffer objects. This is a simple helper class which should cover most FBO uses. It will automatically create a cubemap for the color attachment and a renderbuffer for the depth buffer. You can get a hold of the cubemap by GLFrameBuffer.getTexture(). This class will only work with OpenGL ES 2.0.

FrameBuffers are managed. In case of an OpenGL context loss, which only happens on Android when a user switches to another application or receives an incoming call, the framebuffer will be automatically recreated.

A FrameBuffer must be disposed if it is no longer needed

Typical use:
FrameBufferCubemap frameBuffer = new FrameBufferCubemap(Format.RGBA8888, fSize, fSize, true);
frameBuffer.begin();
while( frameBuffer.nextSide() ) {
frameBuffer.getSide().getUp(camera.up);
frameBuffer.getSide().getDirection(camera.direction);
camera.update();

Gl.clearColor(0, 0, 0, 1);
Gl.clear(Gl.colorBufferBit | Gl.depthBufferBit);
//render something
}
frameBuffer.end();
Cubemap cubemap = frameBuffer.getColorBufferCubemap();

  • Constructor Details

    • FrameBufferCubemap

      protected FrameBufferCubemap(GLFrameBuffer.GLFrameBufferBuilder<? extends GLFrameBuffer<Cubemap>> bufferBuilder)
      Creates a GLFrameBuffer from the specifications provided by bufferBuilder
    • FrameBufferCubemap

      public FrameBufferCubemap(Pixmap.Format format, int width, int height, boolean hasDepth)
      Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached.
    • FrameBufferCubemap

      public FrameBufferCubemap(Pixmap.Format format, int width, int height, boolean hasDepth, boolean hasStencil)
      Creates a new FrameBuffer having the given dimensions and potentially a depth and a stencil buffer attached.
      Parameters:
      format - the format of the color buffer; according to the OpenGL ES 2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are color-renderable
      width - the width of the cubemap in pixels
      height - the height of the cubemap in pixels
      hasDepth - whether to attach a depth buffer
      hasStencil - whether to attach a stencil buffer
      Throws:
      ArcRuntimeException - in case the FrameBuffer could not be created
  • Method Details