public interface GLFBODrawable extends GLDrawable
GLDrawable
specialization,
exposing FBObject
functionality.
A GLFBODrawable
is uninitialized until a GLContext
is bound
and made current the first time, hence only then it's capabilities fully reflect expectations,
i.e. color, depth, stencil and MSAA bits will be valid only after the first makeCurrent()
call.
On-/offscreen bits are valid after setRealized(true)
.
MSAA is used if requested
.
Double buffering is used if requested
.
In MSAA mode, it always uses the implicit 2nd framebuffer
sink
.
Hence double buffering is always the case w/ MSAA.
In non MSAA a second explicit framebuffer
is being used.
This method allows compliance w/ the spec, i.e. read and draw framebuffer selection
and double buffer usage for e.g. glReadPixels(..)
.
This method also allows usage of both textures seperately.
It would be possible to implement double buffering simply using
FBObject.Colorbuffer
s with one framebuffer
.
This would require mode selection and hence complicate the API. Besides, it would
not support differentiation of read and write framebuffer and hence not be spec compliant.
Actual swapping of the FBObject.Colorbuffer
s and/or framebuffer
is performed either in the context current hook
or when swapping buffers
, whatever comes first.
Modifier and Type | Interface and Description |
---|---|
static interface |
GLFBODrawable.Resizeable
Resizeable
GLFBODrawable specialization |
Modifier and Type | Field and Description |
---|---|
static int |
FBOMODE_DEFAULT
FBO Default Mode Bit:
FBOMODE_USE_TEXTURE | FBOMODE_USE_DEPTH . |
static int |
FBOMODE_USE_DEPTH
FBO Mode Bit: Use a depth renderbuffer (
default ), see setFBOMode(int) . |
static int |
FBOMODE_USE_TEXTURE
FBO Mode Bit: Use a
FBObject.TextureAttachment for the render colorbuffer (default ), see setFBOMode(int) . |
Modifier and Type | Method and Description |
---|---|
com.jogamp.opengl.FBObject.Colorbuffer |
getColorbuffer(int bufferName)
Returns the named
FBObject.Colorbuffer instance. |
com.jogamp.opengl.FBObject |
getFBObject(int bufferName)
If MSAA is being used and
GL.GL_FRONT is requested,
the internal FBObject sample sink is being returned. |
int |
getFBOMode() |
int |
getNumBuffers() |
int |
getNumSamples() |
int |
getTextureUnit() |
boolean |
isInitialized() |
void |
resetSize(GL gl)
Notify this instance about upstream size change
to reconfigure the
FBObject . |
void |
setFBOMode(int modeBits)
Set the FBO mode bits used for FBO creation.
|
int |
setNumBuffers(int bufferCount)
Sets the number of buffers (FBO) being used if using
double buffering . |
void |
setNumSamples(GL gl,
int newSamples)
Set the number of sample buffers if using MSAA
|
void |
setTextureUnit(int unit) |
createContext, getChosenGLCapabilities, getFactory, getGLProfile, getHandle, getNativeSurface, getRequestedGLCapabilities, getSurfaceHeight, getSurfaceWidth, isGLOriented, isRealized, setRealized, swapBuffers, toString
static final int FBOMODE_USE_TEXTURE
FBObject.TextureAttachment
for the render colorbuffer
(default
), see setFBOMode(int)
.static final int FBOMODE_USE_DEPTH
default
), see setFBOMode(int)
.static final int FBOMODE_DEFAULT
FBOMODE_USE_TEXTURE
| FBOMODE_USE_DEPTH
.boolean isInitialized()
true
if initialized, i.e. a GLContext
is bound and made current once, otherwise false
.void setFBOMode(int modeBits) throws IllegalStateException
See FBOMODE_DEFAULT
values.
modeBits
- custom FBO mode bits like FBOMODE_USE_TEXTURE
and FBOMODE_USE_DEPTH
.IllegalStateException
- if the underlying FBO is already isInitialized()
.int getFBOMode()
setFBOMode(int)
void resetSize(GL gl) throws GLException
FBObject
.gl
- GL context object bound to this drawable, will be made current during operation.
A prev. current context will be make current after operation.GLException
- if resize operation failedint getTextureUnit()
void setTextureUnit(int unit)
unit
- the texture unit to be usedvoid setNumSamples(GL gl, int newSamples) throws GLException
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
- new sample sizeGLException
- if resetting the FBO failedint getNumSamples()
int setNumBuffers(int bufferCount) throws GLException
double buffering
.
If double buffering
is not chosen, this is a NOP.
Must be called before initialization
, otherwise an exception is thrown.
bufferCount
(see above)GLException
- if already initialized, see isInitialized()
.int getNumBuffers()
double buffering
,
otherwise ≥ 2, depending on setNumBuffers(int)
.com.jogamp.opengl.FBObject getFBObject(int bufferName) throws IllegalArgumentException
GL.GL_FRONT
is requested,
the internal FBObject
sample sink
is being returned.bufferName
- GL.GL_FRONT
and GL.GL_BACK
are valid buffer namesFBObject
IllegalArgumentException
- if an illegal buffer name is being usedcom.jogamp.opengl.FBObject.Colorbuffer getColorbuffer(int bufferName) throws IllegalArgumentException
FBObject.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 FBObject.Colorbuffer
is either a FBObject.TextureAttachment
(default
) or a FBObject.ColorAttachment
,
see FBObject.Colorbuffer.isTextureAttachment()
.
bufferName
- GL.GL_FRONT
and GL.GL_BACK
are valid buffer namesFBObject.Colorbuffer
IllegalArgumentException
- if using MSAA and GL.GL_BACK
is requested or an illegal buffer name is being usedCopyright 2010 JogAmp Community.