Top Description Inners Fields Constructors Methods
jogamp.opengl

public Class GLFBODrawableImpl

extends GLDrawableImpl
implements GLFBODrawable
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.GLFBODrawable, com.jogamp.opengl.GLDrawable, com.jogamp.nativewindow.NativeSurfaceHolder
Known Direct Subclasses
jogamp.opengl.GLFBODrawableImpl.ResizeableImpl
Imports
com.jogamp.nativewindow.NativeSurface, .NativeWindowException, .ProxySurface, .UpstreamSurfaceHook, .MutableGraphicsConfiguration, com.jogamp.opengl.GL, .GLCapabilities, .GLCapabilitiesImmutable, .GLContext, .GLException, .GLFBODrawable, .FBObject, .GLRendererQuirks, .FBObject.Attachment, .FBObject.Colorbuffer, .FBObject.TextureAttachment, .JoglVersion, com.jogamp.common.ExceptionUtils, com.jogamp.common.util.PropertyAccess, .VersionUtil

FBObject offscreen GLDrawable implementation, i.e. GLFBODrawable.

It utilizes the context lifecycle hook contextRealized(GLContext, boolean) to initialize the FBObject instance.

It utilizes the context current hook contextMadeCurrent(context, true) to bind the FBO.

See GLFBODrawable for double buffering details.
See Also
GLDrawableImpl#contextRealized(GLContext, boolean), GLDrawableImpl#contextMadeCurrent(GLContext, boolean), GLDrawableImpl#getDefaultDrawFramebuffer(), GLDrawableImpl#getDefaultReadFramebuffer()

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static interface

Field Summary

Modifier and TypeField and Description
private static final int
bufferCount

number of FBOs for double buffering.

protected static final boolean
protected static final boolean
private boolean
fboBound

Indicates whether the FBO is bound.

private int
private int
private int
private boolean
private FBObject[]
private boolean
fboSwapped

Indicates whether the FBO is swapped, resets to false after makeCurrent -> contextMadeCurrent.

private static final String
private boolean
private int
private GLCapabilitiesImmutable
private final GLDrawableImpl
private int
private static volatile boolean
resetQuirkInfoDumped

dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode

private int
private GLFBODrawableImpl.SwapBufferContext
private int
Inherited from jogamp.opengl.GLDrawableImpl:
factoryrealizedrequestedCapabilitiessurface

Constructor Summary

AccessConstructor and Description
protected
GLFBODrawableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final NativeSurface surface, final GLCapabilitiesImmutable
the requested FBO capabilities
fboCaps
,
final int textureUnit)

Method Summary

Modifier and TypeMethod and Description
protected void
associateContext(final GLContext
the just bounded or unbounded context
glc
,
final boolean
if true create an association, otherwise remove it
bound
)

Overrides jogamp.opengl.GLDrawableImpl.associateContext.

Callback for special implementations, allowing
  • to associate bound context to this drawable (bound == true) or to remove such association (bound == false).
  • to trigger GLContext/GLDrawable related lifecycle: construct, destroy.
protected final void
contextMadeCurrent(final GLContext glc, final boolean current)

Overrides jogamp.opengl.GLDrawableImpl.contextMadeCurrent.

Callback for special implementations, allowing GLContext to trigger GL related lifecycle: makeCurrent, release.
public final GLContext
createContext(final GLContext shareWith)

Implements com.jogamp.opengl.GLDrawable.createContext.

Creates a new context for drawing to this drawable that will optionally share buffer objects, textures and other server-side OpenGL objects with the specified GLContext.
public final FBObject.Colorbuffer
getColorbuffer(final int
GL#GL_FRONT and GL#GL_BACK are valid buffer names
bufferName
)

Implements com.jogamp.opengl.GLFBODrawable.getColorbuffer.

Returns the named Colorbuffer instance.
protected final int
getDefaultDrawFramebuffer()

Overrides jogamp.opengl.GLDrawableImpl.getDefaultDrawFramebuffer.

Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer.
protected final int
getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead)

Overrides jogamp.opengl.GLDrawableImpl.getDefaultReadBuffer.

Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer.
protected final int
getDefaultReadFramebuffer()

Overrides jogamp.opengl.GLDrawableImpl.getDefaultReadFramebuffer.

Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer.
public FBObject
getFBObject(final int
GL#GL_FRONT and GL#GL_BACK are valid buffer names
bufferName
)

Implements com.jogamp.opengl.GLFBODrawable.getFBObject.

// TODO: Add or remove TEXTURE (only) DoubleBufferMode support
public final int
public final int
public final int
public final int
private final void
initialize(final boolean realize, final GL gl)

public final boolean
private final void
reset(final GL gl, final int idx, final int width, final int height, final int samples, final boolean useAlpha, final int depthBits, final int stencilBits)

private final void
reset(final GL gl, int newSamples)

public final void
resetSize(final GL
GL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.
gl
)

Implements com.jogamp.opengl.GLFBODrawable.resetSize.

Notify this instance about upstream size change to reconfigure the FBObject.
public final void
setFBOMode(final int
custom FBO mode bits like FBOMODE_USE_TEXTURE.
modeBits
)

Implements com.jogamp.opengl.GLFBODrawable.setFBOMode.

Set the FBO mode bits used for FBO creation.
public final int
setNumBuffers(final int bufferCount)

Implements com.jogamp.opengl.GLFBODrawable.setNumBuffers.

Sets the number of buffers (FBO) being used if using double buffering.
public void
setNumSamples(final GL
GL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.
gl
,
final int
new sample size
newSamples
)

Implements com.jogamp.opengl.GLFBODrawable.setNumSamples.

Set the number of sample buffers if using MSAA
protected final void
setRealizedImpl()

Implements abstract jogamp.opengl.GLDrawableImpl.setRealizedImpl.

Platform specific realization of drawable
public final void
public final void
setTextureUnit(final int
the texture unit to be used
u
)

Implements com.jogamp.opengl.GLFBODrawable.setTextureUnit.

private final void
setupFBO(final GL gl, final int idx, final int width, final int height, final int samples, final boolean useAlpha, final int depthBits, final int stencilBits, final boolean useTexture, final boolean setupViewportScissors, final boolean realUnbind)

protected void
swapBuffersImpl(final boolean
indicates whether double buffering is enabled, see above.
doubleBuffered
)

Implements abstract jogamp.opengl.GLDrawableImpl.swapBuffersImpl.

Platform and implementation depending surface swap.
private final void
private final void
public String
toString()

Overrides jogamp.opengl.GLDrawableImpl.toString.

Implements com.jogamp.opengl.GLDrawable.toString.

Returns a string representation of the object.
Inherited from jogamp.opengl.GLDrawableImpl:
createHandledestroyHandlegetChosenGLCapabilitiesgetFactorygetFactoryImplgetGLProfilegetHandlegetNativeSurfacegetRequestedGLCapabilitiesgetSurfaceHeightgetSurfaceWidthgetThreadNameisGLOrientedisRealizedlockSurfacesetRealizedswapBufferstoHexStringunlockSurface

Field Detail

bufferCountback to summary
private static final int bufferCount

number of FBOs for double buffering.

Todo

Possible to configure!

DEBUGback to summary
protected static final boolean DEBUG

Hides jogamp.opengl.GLDrawableImpl.DEBUG.

DEBUG_SWAPback to summary
protected static final boolean DEBUG_SWAP
fboBoundback to summary
private boolean fboBound

Indicates whether the FBO is bound.

fboIBackback to summary
private int fboIBack
fboIFrontback to summary
private int fboIFront
fboModeBitsback to summary
private int fboModeBits
fboResetQuirkback to summary
private boolean fboResetQuirk
fbosback to summary
private FBObject[] fbos
fboSwappedback to summary
private boolean fboSwapped

Indicates whether the FBO is swapped, resets to false after makeCurrent -> contextMadeCurrent.

illegalBufferNameback to summary
private static final String illegalBufferName
initializedback to summary
private boolean initialized
maxSamplesback to summary
private int maxSamples
origParentChosenCapsback to summary
private GLCapabilitiesImmutable origParentChosenCaps
parentback to summary
private final GLDrawableImpl parent
pendingFBOResetback to summary
private int pendingFBOReset
resetQuirkInfoDumpedback to summary
private static volatile boolean resetQuirkInfoDumped

dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode

samplesback to summary
private int samples
swapBufferContextback to summary
private GLFBODrawableImpl.SwapBufferContext swapBufferContext
texUnitback to summary
private int texUnit

Constructor Detail

GLFBODrawableImplback to summary
protected GLFBODrawableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final NativeSurface surface, final GLCapabilitiesImmutable fboCaps, final int textureUnit)
Parameters
fboCaps:GLCapabilitiesImmutable

the requested FBO capabilities

Method Detail

associateContextback to summary
protected void associateContext(final GLContext glc, final boolean bound)

Overrides jogamp.opengl.GLDrawableImpl.associateContext.

Doc from jogamp.opengl.GLDrawableImpl.associateContext.

Callback for special implementations, allowing

  • to associate bound context to this drawable (bound == true) or to remove such association (bound == false).
  • to trigger GLContext/GLDrawable related lifecycle: construct, destroy.

If bound is true, the context is current and being newly associated w/ this drawable.

If bound is false, the context is still current and will be unbound (released and destroyed, or simply disassociated).

Being called by GLContextImpl#associateDrawable(boolean).

Parameters
glc:GLContext

the just bounded or unbounded context

bound:boolean

if true create an association, otherwise remove it

Annotations
@Override
contextMadeCurrentback to summary
protected final void contextMadeCurrent(final GLContext glc, final boolean current)

Overrides jogamp.opengl.GLDrawableImpl.contextMadeCurrent.

Doc from jogamp.opengl.GLDrawableImpl.contextMadeCurrent.

Callback for special implementations, allowing GLContext to trigger GL related lifecycle: makeCurrent, release.

If current is true, the context has just been made current.

If current is false, the context is still current and will be release after this method returns.

Being called by GLContextImpl#contextMadeCurrent(boolean).

Annotations
@Override
createContextback to summary
public final GLContext createContext(final GLContext shareWith)

Implements com.jogamp.opengl.GLDrawable.createContext.

Doc from com.jogamp.opengl.GLDrawable.createContext.

Creates a new context for drawing to this drawable that will optionally share buffer objects, textures and other server-side OpenGL objects with the specified GLContext.

The GLContext share need not be associated with this GLDrawable and may be null if sharing of display lists and other objects is not desired. See the note in the overview documentation context sharing as well as GLSharedContextSetter.

Annotations
@Override
getColorbufferback to summary
public final FBObject.Colorbuffer getColorbuffer(final int bufferName) throws IllegalArgumentException

Implements com.jogamp.opengl.GLFBODrawable.getColorbuffer.

Doc from com.jogamp.opengl.GLFBODrawable.getColorbuffer.

Returns the named Colorbuffer instance.

If MSAA is being used, only the GL#GL_FRONT buffer is accessible and an exception is being thrown if GL#GL_BACK is being requested.

Depending on the fbo mode the resulting Colorbuffer is either a TextureAttachment if FBOMODE_USE_TEXTURE is set, otherwise a ColorAttachment. See Colorbuffer#isTextureAttachment().

Parameters
bufferName:int

GL#GL_FRONT and GL#GL_BACK are valid buffer names

Returns:FBObject.Colorbuffer

the named Colorbuffer

Annotations
@Override
Exceptions
IllegalArgumentException:
if using MSAA and GL#GL_BACK is requested or an illegal buffer name is being used
getDefaultDrawFramebufferback to summary
protected final int getDefaultDrawFramebuffer()

Overrides jogamp.opengl.GLDrawableImpl.getDefaultDrawFramebuffer.

Doc from jogamp.opengl.GLDrawableImpl.getDefaultDrawFramebuffer.

Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.

Annotations
@Override
getDefaultReadBufferback to summary
protected final int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead)

Overrides jogamp.opengl.GLDrawableImpl.getDefaultReadBuffer.

Doc from jogamp.opengl.GLDrawableImpl.getDefaultReadBuffer.

Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer.

Annotations
@Override
getDefaultReadFramebufferback to summary
protected final int getDefaultReadFramebuffer()

Overrides jogamp.opengl.GLDrawableImpl.getDefaultReadFramebuffer.

Doc from jogamp.opengl.GLDrawableImpl.getDefaultReadFramebuffer.

Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero.

Annotations
@Override
getFBObjectback to summary
public FBObject getFBObject(final int bufferName) throws IllegalArgumentException

Implements com.jogamp.opengl.GLFBODrawable.getFBObject.

// TODO: Add or remove TEXTURE (only) DoubleBufferMode support

Parameters
bufferName:int

Doc from com.jogamp.opengl.GLFBODrawable.getFBObject.

GL#GL_FRONT and GL#GL_BACK are valid buffer names

Returns:FBObject

Doc from com.jogamp.opengl.GLFBODrawable.getFBObject.

the named FBObject

Annotations
@Override
Exceptions
IllegalArgumentException:

Doc from com.jogamp.opengl.GLFBODrawable.getFBObject.

if an illegal buffer name is being used

getFBOModeback to summary
public final int getFBOMode()

Implements com.jogamp.opengl.GLFBODrawable.getFBOMode.

Returns:int

Doc from com.jogamp.opengl.GLFBODrawable.getFBOMode.

the used FBO mode bits, mutable via setFBOMode(int)

Annotations
@Override
getNumBuffersback to summary
public final int getNumBuffers()

Implements com.jogamp.opengl.GLFBODrawable.getNumBuffers.

Returns:int

Doc from com.jogamp.opengl.GLFBODrawable.getNumBuffers.

the number of buffers (FBO) being used. 1 if not using double buffering, otherwise ≥ 2, depending on setNumBuffers(int).

Annotations
@Override
getNumSamplesback to summary
public final int getNumSamples()

Implements com.jogamp.opengl.GLFBODrawable.getNumSamples.

Returns:int

Doc from com.jogamp.opengl.GLFBODrawable.getNumSamples.

the number of sample buffers if using MSAA, otherwise 0

Annotations
@Override
getTextureUnitback to summary
public final int getTextureUnit()

Implements com.jogamp.opengl.GLFBODrawable.getTextureUnit.

Returns:int

Doc from com.jogamp.opengl.GLFBODrawable.getTextureUnit.

the used texture unit

Annotations
@Override
initializeback to summary
private final void initialize(final boolean realize, final GL gl)
isInitializedback to summary
public final boolean isInitialized()

Implements com.jogamp.opengl.GLFBODrawable.isInitialized.

Returns:boolean

Doc from com.jogamp.opengl.GLFBODrawable.isInitialized.

true if initialized, i.e. a GLContext is bound and made current once, otherwise false.

Annotations
@Override
resetback to summary
private final void reset(final GL gl, final int idx, final int width, final int height, final int samples, final boolean useAlpha, final int depthBits, final int stencilBits)
resetback to summary
private final void reset(final GL gl, int newSamples) throws GLException
resetSizeback to summary
public final void resetSize(final GL gl) throws GLException

Implements com.jogamp.opengl.GLFBODrawable.resetSize.

Doc from com.jogamp.opengl.GLFBODrawable.resetSize.

Notify this instance about upstream size change to reconfigure the FBObject.

Parameters
gl:GL

GL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.

Annotations
@Override
Exceptions
GLException:
if resize operation failed
setFBOModeback to summary
public final void setFBOMode(final int modeBits) throws IllegalStateException

Implements com.jogamp.opengl.GLFBODrawable.setFBOMode.

Doc from com.jogamp.opengl.GLFBODrawable.setFBOMode.

Set the FBO mode bits used for FBO creation.

Default value is: FBOMODE_USE_TEXTURE.

If GLRendererQuirks#BuggyColorRenderbuffer is set, FBOMODE_USE_TEXTURE is always added at initialization.

Parameters
modeBits:int

custom FBO mode bits like FBOMODE_USE_TEXTURE.

Annotations
@Override
Exceptions
IllegalStateException:
if already initialized, see isInitialized().
setNumBuffersback to summary
public final int setNumBuffers(final int bufferCount) throws IllegalStateException, GLException

Implements com.jogamp.opengl.GLFBODrawable.setNumBuffers.

Doc from com.jogamp.opengl.GLFBODrawable.setNumBuffers.

Sets the number of buffers (FBO) being used if using double buffering.

If double buffering is not chosen, this is a NOP.

Must be called before initialization, otherwise an exception is thrown.

Returns:int

the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above)

Annotations
@Override
Exceptions
IllegalStateException:
if already initialized, see isInitialized().
setNumSamplesback to summary
public void setNumSamples(final GL gl, final int newSamples) throws GLException

Implements com.jogamp.opengl.GLFBODrawable.setNumSamples.

Doc from com.jogamp.opengl.GLFBODrawable.setNumSamples.

Set the number of sample buffers if using MSAA

Parameters
gl:GL

GL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.

newSamples:int

new sample size

Annotations
@Override
Exceptions
GLException:
if resetting the FBO failed
setRealizedImplback to summary
protected final void setRealizedImpl()

Implements abstract jogamp.opengl.GLDrawableImpl.setRealizedImpl.

Doc from jogamp.opengl.GLDrawableImpl.setRealizedImpl.

Platform specific realization of drawable

Annotations
@Override
setSwapBufferContextback to summary
public final void setSwapBufferContext(final GLFBODrawableImpl.SwapBufferContext sbc)
setTextureUnitback to summary
public final void setTextureUnit(final int u)

Implements com.jogamp.opengl.GLFBODrawable.setTextureUnit.

Parameters
u:int

Doc from com.jogamp.opengl.GLFBODrawable.setTextureUnit.

the texture unit to be used

Annotations
@Override
setupFBOback to summary
private final void setupFBO(final GL gl, final int idx, final int width, final int height, final int samples, final boolean useAlpha, final int depthBits, final int stencilBits, final boolean useTexture, final boolean setupViewportScissors, final boolean realUnbind)
swapBuffersImplback to summary
protected void swapBuffersImpl(final boolean doubleBuffered)

Implements abstract jogamp.opengl.GLDrawableImpl.swapBuffersImpl.

Doc from jogamp.opengl.GLDrawableImpl.swapBuffersImpl.

Platform and implementation depending surface swap.

The surface is locked.

If doubleBuffered is true, an actual platform dependent surface swap shall be executed.

If doubleBuffered is false, GL#glFlush() has been called already and the implementation may execute implementation specific code.

Parameters
doubleBuffered:boolean

indicates whether double buffering is enabled, see above.

Annotations
@Override
swapFBOImplback to summary
private final void swapFBOImpl(final GLContext glc)
swapFBOImplPostback to summary
private final void swapFBOImplPost(final GLContext glc)
toStringback to summary
public String toString()

Overrides jogamp.opengl.GLDrawableImpl.toString.

Implements com.jogamp.opengl.GLDrawable.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
jogamp.opengl back to summary

public Class GLFBODrawableImpl.ResizeableImpl

extends GLFBODrawableImpl
implements Resizeable
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.GLFBODrawable.Resizeable, com.jogamp.opengl.GLFBODrawable, com.jogamp.opengl.GLDrawable, com.jogamp.nativewindow.NativeSurfaceHolder

Field Summary

Inherited from jogamp.opengl.GLFBODrawableImpl:
DEBUGDEBUG_SWAP

Constructor Summary

AccessConstructor and Description
protected
ResizeableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final ProxySurface surface, final GLCapabilitiesImmutable fboCaps, final int textureUnit)

Method Summary

Modifier and TypeMethod and Description
public final void
setSurfaceSize(final GLContext
the GLContext bound to this drawable, will be made current during operation A prev. current context will be make current after operation.
context
,
final int
new width in pixel units
newWidth
,
final int
new width in pixel units
newHeight
)

Implements com.jogamp.opengl.GLFBODrawable.Resizeable.setSurfaceSize.

Resize this GLFBODrawable's surface.
Inherited from jogamp.opengl.GLFBODrawableImpl:
associateContextcontextMadeCurrentcreateContextgetColorbuffergetDefaultDrawFramebuffergetDefaultReadBuffergetDefaultReadFramebuffergetFBObjectgetFBOModegetNumBuffersgetNumSamplesgetTextureUnitisInitializedresetSizesetFBOModesetNumBufferssetNumSamplessetRealizedImplsetSwapBufferContextsetTextureUnitswapBuffersImpltoString

Constructor Detail

ResizeableImplback to summary
protected ResizeableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final ProxySurface surface, final GLCapabilitiesImmutable fboCaps, final int textureUnit)

Method Detail

setSurfaceSizeback to summary
public final void setSurfaceSize(final GLContext context, final int newWidth, final int newHeight) throws NativeWindowException, GLException

Implements com.jogamp.opengl.GLFBODrawable.Resizeable.setSurfaceSize.

Doc from com.jogamp.opengl.GLFBODrawable.Resizeable.setSurfaceSize.

Resize this GLFBODrawable's surface.

This drawable is being locked during operation.

Parameters
context:GLContext

the GLContext bound to this drawable, will be made current during operation A prev. current context will be make current after operation.

newWidth:int

new width in pixel units

newHeight:int

new width in pixel units

Annotations
@Override
Exceptions
NativeWindowException:
in case the surface could no be locked
GLException:
in case an error during the resize operation occurred
jogamp.opengl back to summary

public Interface GLFBODrawableImpl.SwapBufferContext


Method Summary

Modifier and TypeMethod and Description
public void
swapBuffers(boolean doubleBuffered)

Method Detail

swapBuffersback to summary
public void swapBuffers(boolean doubleBuffered)