JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.GLFBODrawable Interface Reference

Platform-independent GLDrawable specialization, exposing FBObject functionality. More...

Inheritance diagram for com.jogamp.opengl.GLFBODrawable:
Collaboration diagram for com.jogamp.opengl.GLFBODrawable:

Classes

interface  Resizeable
 Resizeable GLFBODrawable specialization. More...
 

Public Member Functions

boolean isInitialized ()
 
void setFBOMode (final int modeBits) throws IllegalStateException
 Set the FBO mode bits used for FBO creation. More...
 
int getFBOMode ()
 
void resetSize (final GL gl) throws GLException
 Notify this instance about upstream size change to reconfigure the FBObject. More...
 
int getTextureUnit ()
 
void setTextureUnit (final int unit)
 
void setNumSamples (final GL gl, final int newSamples) throws GLException
 Set the number of sample buffers if using MSAA. More...
 
int getNumSamples ()
 
int setNumBuffers (final int bufferCount) throws IllegalStateException, GLException
 Sets the number of buffers (FBO) being used if using double buffering. More...
 
int getNumBuffers ()
 
FBObject getFBObject (final int bufferName) throws IllegalArgumentException
 Sets the DoubleBufferMode. More...
 
Colorbuffer getColorbuffer (final int bufferName) throws IllegalArgumentException
 Returns the named Colorbuffer instance. More...
 
- Public Member Functions inherited from com.jogamp.opengl.GLDrawable
GLContext createContext (GLContext shareWith)
 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. More...
 
void setRealized (boolean realized)
 Indicates to GLDrawable implementations whether the underlying surface has been created and can be drawn into. More...
 
boolean isRealized ()
 Returns true if this drawable is realized, otherwise false. More...
 
int getSurfaceWidth ()
 Returns the width of this GLDrawable's surface client area in pixel units. More...
 
int getSurfaceHeight ()
 Returns the height of this GLDrawable's surface client area in pixel units. More...
 
boolean isGLOriented ()
 Returns true if the drawable is rendered in OpenGL's coordinate system, origin at bottom left. More...
 
void swapBuffers () throws GLException
 Swaps the front and back buffers of this drawable. More...
 
GLCapabilitiesImmutable getChosenGLCapabilities ()
 Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / visual / GLProfile) for this drawable. More...
 
GLCapabilitiesImmutable getRequestedGLCapabilities ()
 Fetches the GLCapabilitiesImmutable corresponding to the user requested OpenGL capabilities (pixel format / visual / GLProfile) for this drawable. More...
 
GLProfile getGLProfile ()
 Fetches the GLProfile for this drawable. More...
 
NativeSurface getNativeSurface ()
 Returns the associated NativeSurface of this NativeSurfaceHolder. More...
 
long getHandle ()
 Returns the GL drawable handle, guaranteed to be valid after realization and while it's surface is being locked. More...
 
GLDrawableFactory getFactory ()
 Return the GLDrawableFactory being used to create this instance. More...
 
String toString ()
 
NativeSurface getNativeSurface ()
 Returns the associated NativeSurface of this NativeSurfaceHolder. More...
 

Static Public Attributes

static final int FBOMODE_USE_TEXTURE = 1 << 0
 FBO Mode Bit: Use a TextureAttachment for the render colorbuffer, see setFBOMode(int). More...
 

Detailed Description

Platform-independent 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 Colorbuffers 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 Colorbuffers and/or framebuffer is performed either in the context current hook or when swapping buffers, whatever comes first.

Definition at line 78 of file GLFBODrawable.java.

Member Function Documentation

◆ getColorbuffer()

Colorbuffer com.jogamp.opengl.GLFBODrawable.getColorbuffer ( final int  bufferName) throws IllegalArgumentException

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
bufferNameGL#GL_FRONT and GL#GL_BACK are valid buffer names
Returns
the named Colorbuffer
Exceptions
IllegalArgumentExceptionif using MSAA and GL#GL_BACK is requested or an illegal buffer name is being used

◆ getFBObject()

FBObject com.jogamp.opengl.GLFBODrawable.getFBObject ( final int  bufferName) throws IllegalArgumentException

Sets the DoubleBufferMode.

Returns
the used DoubleBufferMode Must be called before initialization, otherwise an exception is thrown.

This call has no effect is MSAA is selected, since MSAA always forces the mode to FBO. Also setting the mode to NONE where double buffering is requested or setting a double buffering mode w/o request will be ignored.

Since TEXTURE mode is currently not implemented, this method has no effect.

Exceptions
GLExceptionif already initialized, see isInitialized(). If MSAA is being used and GL#GL_FRONT is requested, the internal FBObject sample sink is being returned.
Parameters
bufferNameGL#GL_FRONT and GL#GL_BACK are valid buffer names
Returns
the named FBObject
Exceptions
IllegalArgumentExceptionif an illegal buffer name is being used

◆ getFBOMode()

int com.jogamp.opengl.GLFBODrawable.getFBOMode ( )
Returns
the used FBO mode bits, mutable via setFBOMode(int)

◆ getNumBuffers()

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

◆ getNumSamples()

int com.jogamp.opengl.GLFBODrawable.getNumSamples ( )
Returns
the number of sample buffers if using MSAA, otherwise 0

◆ getTextureUnit()

int com.jogamp.opengl.GLFBODrawable.getTextureUnit ( )
Returns
the used texture unit

◆ isInitialized()

boolean com.jogamp.opengl.GLFBODrawable.isInitialized ( )
Returns
true if initialized, i.e. a GLContext is bound and made current once, otherwise false.

◆ resetSize()

void com.jogamp.opengl.GLFBODrawable.resetSize ( final GL  gl) throws GLException

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

Parameters
glGL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.
Exceptions
GLExceptionif resize operation failed

◆ setFBOMode()

void com.jogamp.opengl.GLFBODrawable.setFBOMode ( final int  modeBits) throws IllegalStateException

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
modeBitscustom FBO mode bits like FBOMODE_USE_TEXTURE.
Exceptions
IllegalStateExceptionif already initialized, see isInitialized().

◆ setNumBuffers()

int com.jogamp.opengl.GLFBODrawable.setNumBuffers ( final int  bufferCount) throws IllegalStateException, GLException

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
the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above)
Exceptions
IllegalStateExceptionif already initialized, see isInitialized().

◆ setNumSamples()

void com.jogamp.opengl.GLFBODrawable.setNumSamples ( final GL  gl,
final int  newSamples 
) throws GLException

Set the number of sample buffers if using MSAA.

Parameters
glGL context object bound to this drawable, will be made current during operation. A prev. current context will be make current after operation.
newSamplesnew sample size
Exceptions
GLExceptionif resetting the FBO failed

◆ setTextureUnit()

void com.jogamp.opengl.GLFBODrawable.setTextureUnit ( final int  unit)
Parameters
unitthe texture unit to be used

Member Data Documentation

◆ FBOMODE_USE_TEXTURE

final int com.jogamp.opengl.GLFBODrawable.FBOMODE_USE_TEXTURE = 1 << 0
static

FBO Mode Bit: Use a TextureAttachment for the render colorbuffer, see setFBOMode(int).

Definition at line 82 of file GLFBODrawable.java.


The documentation for this interface was generated from the following file: