Maven module :un.engine : engine-opengl-util :
Class : un.impl.opengl.resource.FBO
Extends/Implements : un.impl.opengl.resource.AbstractResource
Subclasses : -

Resource to manipulate a frame buffer object.
http://www.opengl.org/wiki/Framebuffer_Object
author  Johann Sorel


Variables : attachments
Functions : FBO, getWidth, getHeight, resize, resample, getAttachements, addAttachment, addAttachment, removeAttachment, getGpuID, getTexture, getColorTexture, getDepthTexture, getStencilTexture, getDepthStencilTexture, isOnSystemMemory, isOnGpuMemory, loadOnSystemMemory, loadOnGpuMemory, unloadFromSystemMemory, unloadFromGpuMemory, bind, unbind, blit, createBlitFBO, toChars




protected Sequence attachments



param  width fbo width
param  height fbo height
public void FBO (int width, int height)

public int getWidth ()

public int getHeight ()


Resize the FBO.
Warning : all texture datas will be lost.
param  width newwidth
param  height newheight
public void resize (GL gl, int width, int height)


Change the multisampling value.
This method can only be used if the FBO is already multisampled.
Warning : all texture datas will be lost.
param  nbSample
public void resample (GL gl, int nbSample)


Returns an array of all fbo attachements.
return  FBOAttachment array, never null, can be empty.
public FBOAttachment[] getAttachements ()

public void addAttachment (int type, Texture texture)

public void addAttachment (FBOAttachment att)

public void removeAttachment (int type)


return  on gpu fbo id.
public int getGpuID ()


param  type one of GLC.FBO.Attachment
return
public Texture getTexture (int type)


In memory color image.
return  Image or null if not loaded on system memory
public Texture getColorTexture ()


In memory depth image.
return  Image or null if not loaded on system memory
public Texture getDepthTexture ()


In memory stencil image.
return  Image or null if not loaded on system memory
public Texture getStencilTexture ()


In memory depth stencil image.
return  Image or null if not loaded on system memory
public Texture getDepthStencilTexture ()


{@inheritDoc }
public boolean isOnSystemMemory ()


{@inheritDoc }
public boolean isOnGpuMemory ()


{@inheritDoc }
public void loadOnSystemMemory (GL gl)


OpenGL constraints : GL2GL3

{@inheritDoc }
public void loadOnGpuMemory (GL gl)


{@inheritDoc }
public void unloadFromSystemMemory (GL gl)


{@inheritDoc }
public void unloadFromGpuMemory (GL gl)


Bind frame buffer.

The color attachment are bind using there attachment number.
Color attachement 0 must be used with GLSL layout 0
Color attachement 1 must be used with GLSL layout 1
...etc...

@param gl
public void bind (GL gl)


Unbind frame buffer.
param  gl
public void unbind (GL gl)


Blit (copy removing multisampling) each attachment to target fbo.
OpenGL constraints : GL2
param  gl
param  blitFBO
public void blit (GL gl, FBO blitFBO)


Create an FBO which map all textures.
Use only if this FBO uses Multisampling.
return  FBO
public FBO createBlitFBO ()

public Chars toChars ()