Package panamagl.offscreen
Class AFBO
java.lang.Object
panamagl.offscreen.AFBO
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected intprotected MemorySegmentprotected intheight of the canvas using this FBO for renderingprotected intid of the frame buffer returned by the GPUprotected intif of the render buffer returned by the GPUprotected intid of the texture returned by the GPUprotected intprotected MemorySegmentprotected MemorySegmentprotected booleanindicates that dimensions have changed and that buffers must be resized.protected ArenaData arena to create buffers shared with GPU.protected MemorySegmentprotected MemorySegmentprotected intprotected intwidth of the canvas using this FBO for rendering -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBind this FBO so that the following GL commands target it, e.g.protected abstract voidbindFramebuffer(int id) Bind the framebuffer having the given id, or the default framebuffer if the id is 0.protected voiddiagnoseError(GL gl, String item) Print error in consoleintintgetWidth()booleanprotected voidPrepare the memory manager for offscreen rendering by the GPU.protected voidRelease all memory used to manage offscreen rendering by the GPU.voidresize(int width, int height) Set dimensions and reset 'prepared' state if the dimensions actually changed.voidBind back the default framebuffer, so that the following GL commands do not target this FBO anymore.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface panamagl.offscreen.FBO
prepare, readPixels, release
-
Field Details
-
debug
protected boolean debug -
format
protected int format -
internalFormat
protected int internalFormat -
textureType
protected int textureType -
width
protected int widthwidth of the canvas using this FBO for rendering -
height
protected int heightheight of the canvas using this FBO for rendering -
prepared
protected boolean preparedindicates that dimensions have changed and that buffers must be resized. -
idTexture
protected int idTextureid of the texture returned by the GPU -
idFrameBuffer
protected int idFrameBufferid of the frame buffer returned by the GPU -
idRenderBuffer
protected int idRenderBufferif of the render buffer returned by the GPU -
renderArena
Data arena to create buffers shared with GPU. Will live until the buffers are necessary anymore (e.g. when the FBO is resized and pixel number changes). -
frameBufferIds
-
renderBufferIds
-
textureBufferIds
-
pixelBuffer
-
pixels
-
auto
protected boolean auto
-
-
Constructor Details
-
AFBO
public AFBO()
-
-
Method Details
-
prepareRenderArena
protected void prepareRenderArena()Prepare the memory manager for offscreen rendering by the GPU. -
releaseRenderArena
protected void releaseRenderArena()Release all memory used to manage offscreen rendering by the GPU. -
bindFramebuffer
protected abstract void bindFramebuffer(int id) Bind the framebuffer having the given id, or the default framebuffer if the id is 0. The GL context must be current on the calling thread. -
bind
Description copied from interface:FBOBind this FBO so that the following GL commands target it, e.g. to perform GL work out of the rendering of a canvas such as picking from a mouse event. The FBO is prepared if it is not already, otherwise it is bound as is, i.e. without being recreated nor cleared. The GL context of the canvas must be current on the calling thread. Out of aGLEventListenermethod, the work must therefore be performed with theThreadRedirectof the canvas renderer, which may run it later (seedoc/Multithreading.md) :OffscreenRenderer renderer = canvas.getOffscreenRenderer(); renderer.getThreadRedirect().run(() -> { GL gl = renderer.getGL(); renderer.getFBO().bind(gl); // GL work targeting the canvas framebuffer renderer.getFBO().unbind(gl); }); -
unbind
Description copied from interface:FBOBind back the default framebuffer, so that the following GL commands do not target this FBO anymore. Same thread requirement asFBO.bind(GL). -
diagnoseError
-
resize
-
getWidth
-
getHeight
-
isPrepared
public boolean isPrepared()- Specified by:
isPreparedin interfaceFBO
-