Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
|
Core utility class simplifying usage of framebuffer objects (FBO) with all GLProfile
s.
More...
#include <FBObject.hpp>
Public Member Functions | |
FBObject () | |
Creates an uninitialized FBObject instance. | |
final ColorAttachment | attachColorbuffer (final GL gl, final int attachmentPoint, final boolean alpha) throws GLException |
Attaches a newly created and initialized Colorbuffer , i.e. | |
final Colorbuffer | attachColorbuffer (final GL gl, final int attachmentPoint, final Colorbuffer colbuf) throws GLException |
Attaches a Colorbuffer at the given attachment point and initializes it, if not done yet. | |
final ColorAttachment | attachColorbuffer (final GL gl, final int attachmentPoint, final int internalFormat) throws GLException, IllegalArgumentException |
Attaches a newly created and initialized Colorbuffer , i.e. | |
final void | attachRenderbuffer (final GL gl, final Attachment.Type atype, final int reqBits) throws GLException, IllegalArgumentException |
Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, selecting the internalFormat automatically. | |
final void | attachRenderbuffer (final GL gl, final int internalFormat) throws GLException, IllegalArgumentException |
Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, depending on the internalFormat . | |
final TextureAttachment | attachTexture2D (final GL gl, final int attachmentPoint, final boolean alpha) throws GLException |
Attaches a Colorbuffer , i.e. | |
final TextureAttachment | attachTexture2D (final GL gl, final int attachmentPoint, final boolean alpha, final int magFilter, final int minFilter, final int wrapS, final int wrapT) throws GLException |
Attaches a Colorbuffer , i.e. | |
final TextureAttachment | attachTexture2D (final GL gl, final int attachmentPoint, final int internalFormat, final int dataFormat, final int dataType, final int magFilter, final int minFilter, final int wrapS, final int wrapT) throws GLException |
Attaches a Colorbuffer , i.e. | |
final void | bind (final GL gl) throws GLException |
Bind this FBO, i.e. | |
final ColorAttachment | createColorAttachment (final boolean alpha) |
Creates a ColorAttachment , selecting the format automatically. | |
final void | destroy (final GL gl) |
final void | detachAll (final GL gl) |
Detaches all ColorAttachment s, TextureAttachment s and RenderAttachment s and disposes them. | |
final void | detachAllColorbuffer (final GL gl) |
Detaches all ColorAttachment s and TextureAttachment s and disposes them. | |
final void | detachAllRenderbuffer (final GL gl) |
final void | detachAllTexturebuffer (final GL gl) |
Detaches all TextureAttachment s and disposes them. | |
final Colorbuffer | detachColorbuffer (final GL gl, final int attachmentPoint, final boolean dispose) throws IllegalArgumentException |
Detaches a Colorbuffer , i.e. | |
final void | detachRenderbuffer (final GL gl, final Attachment.Type atype, final boolean dispose) throws IllegalArgumentException |
boolean | equals (final Object o) |
final void | formatToGLCapabilities (final GLCapabilities caps) |
Writes the internal format of the attachments to the given GLCapabilities object. | |
void | free (final GL gl) |
void | free (final GL gl) |
final ColorAttachment | getColorAttachment () |
final Colorbuffer | getColorbuffer (final Colorbuffer ca) |
Returns the passed Colorbuffer if it is attached to this FBO, otherwise null. | |
final Colorbuffer | getColorbuffer (final int attachmentPoint) |
Return the Colorbuffer attachment at attachmentPoint if it is attached to this FBO, otherwise null. | |
final int | getColorbufferAttachmentPoint (final Colorbuffer ca) |
Finds the passed Colorbuffer within the valid range of attachment points using reference comparison only. | |
final int | getColorbufferCount () |
Return the number of attached Colorbuffer s. | |
final int | getDefaultDrawBuffer () |
final int | getDefaultReadBuffer () |
final RenderAttachment | getDepthAttachment () |
Return the depth RenderAttachment attachment. | |
final int | getHeight () |
Returns the height. | |
final int | getMaxColorAttachments () throws GLException |
Returns the maximum number of colorbuffer attachments. | |
final int | getMaxRenderbufferSize () throws GLException |
final int | getMaxSamples () throws GLException |
final int | getMaxTextureSize () throws GLException |
final int | getNumSamples () |
Returns the number of samples for multisampling (MSAA). | |
final int | getReadFramebuffer () |
Returns the framebuffer name to read from. | |
final int | getSamples () |
number of samples, or zero for no multisampling | |
final Colorbuffer | getSamplingSink () |
Return the multisampling Colorbuffer sink, if using multisampling. | |
final FBObject | getSamplingSinkFBO () |
Return the complete multisampling FBObject sink, if using multisampling. | |
final int | getStatus () |
Note that the status may reflect an incomplete state during transition of attachments. | |
final String | getStatusString () |
return the getStatus() as a string. | |
final RenderAttachment | getStencilAttachment () |
Return the stencil RenderAttachment attachment, if exist. | |
final TextureAttachment | getTextureAttachment () |
final int | getTextureAttachmentCount () |
Return the number of attached TextureAttachment s. | |
final int | getWidth () |
Returns the width. | |
final int | getWriteFramebuffer () |
Returns the framebuffer name to render to. | |
final boolean | hasAttachmentUsingAlpha () |
Returns true if any attached Colorbuffer uses alpha, otherwise false. | |
final boolean | hasFullFBOSupport () throws GLException |
int | hashCode () |
void | init (final GL gl, final int newWidth, final int newHeight, final int newSamples) throws IllegalStateException, GLException |
Initializes this FBO's instance. | |
boolean | initialize (final GL gl) throws GLException |
boolean | initialize (final GL gl) throws GLException |
Initializes the texture and set it's parameter, if uninitialized, i.e. | |
final boolean | isBound () |
Returns true if framebuffer object is bound via bind(GL) , otherwise false . | |
final boolean | isBound (final GL gl) |
Returns true if framebuffer object is bound via bind(GL) , otherwise false . | |
final boolean | isDepthStencilPackedFormat () |
final boolean | isInitialized () |
Returns true if this instance has been initialized with reset(GL, int, int) or reset(GL, int, int, int, boolean) , otherwise false | |
final boolean | isModified () |
Returns true if size, sample-count or any attachment of this instance or its sampling-sink has been modified since last sync , use , reset or resetSamplingSink . | |
final boolean | isSamplingBufferDirty () |
Returns true if the multisampling colorbuffer (msaa-buffer) has been flagged dirty by a previous call of bind(GL) , otherwise false . | |
final boolean | isStatusValid () |
The status may even be valid if incomplete during transition of attachments. | |
final boolean | isTextureAttachment () |
final void | markUnbound () |
Method simply marks this FBO unbound w/o interfering w/ the bound framebuffer as perfomed by unbind(GL) . | |
int | objectHashCode () |
RenderAttachment (final Type type, final int iFormat, final int samples, final int width, final int height, final int name) | |
final boolean | reset (final GL gl, int newWidth, int newHeight, int newSamples) throws GLException, IllegalStateException |
Resets this FBO's instance. | |
final boolean | resetSamplingSink (final GL gl) throws GLException |
Manually validates the MSAA sampling sink, if used. | |
final void | setSamples (final int s) |
FBObject | setSamplingSink (final FBObject newSamplingSink) throws IllegalStateException, GLException |
Setting this FBO sampling sink. | |
final boolean | supportsDepth (final int bits) throws GLException |
Returns true if GL#GL_DEPTH_COMPONENT16 , GL#GL_DEPTH_COMPONENT24 or GL#GL_DEPTH_COMPONENT32 is supported, otherwise false . | |
final boolean | supportsPackedDepthStencil () throws GLException |
Returns true if GL#GL_DEPTH24_STENCIL8 is supported, otherwise false . | |
final boolean | supportsRGBA8 () throws GLException |
Returns true if renderbuffer accepts internal format GL#GL_RGB8 and GL#GL_RGBA8 , otherwise false . | |
final boolean | supportsStencil (final int bits) throws GLException |
Returns true if GL#GL_STENCIL_INDEX1 , GL#GL_STENCIL_INDEX4 , GL#GL_STENCIL_INDEX8 or GL2GL3#GL_STENCIL_INDEX16 is supported, otherwise false . | |
final void | syncSamplingSink (final GL gl) |
If multisampling is being used and flagged dirty by a previous call of bind(GL) or after initialization, the msaa-buffers are sampled to it's sink getSamplingTextureSink() . | |
TextureAttachment (final Type type, final int iFormat, final int width, final int height, final int dataFormat, final int dataType, final int magFilter, final int minFilter, final int wrapS, final int wrapT, final int name) | |
String | toString () |
String | toString () |
final String | toString () |
final void | unbind (final GL gl) throws GLException |
Unbind this FBO, i.e. | |
final void | unuse (final GL gl) |
Unbind texture, ie bind 'non' texture 0. | |
final void | use (final GL gl, final TextureAttachment ta) throws IllegalArgumentException |
Synchronize the sampling sink and bind the given TextureAttachment , if not null . | |
Static Public Member Functions | |
static final ColorAttachment | createColorAttachment (final int internalFormat, final int samples, final int width, final int height) |
Creates a ColorAttachment , selecting the format automatically. | |
static final TextureAttachment | createColorTextureAttachment (final GL gl, final boolean alpha, final int width, final int height) |
Creates a color TextureAttachment , i.e. | |
static final TextureAttachment | createColorTextureAttachment (final GL gl, final boolean alpha, final int width, final int height, final int magFilter, final int minFilter, final int wrapS, final int wrapT) |
Creates a color TextureAttachment , i.e. | |
static final TextureAttachment | createColorTextureAttachment (final GL gl, final int internalFormat, final int width, final int height, final int magFilter, final int minFilter, final int wrapS, final int wrapT) |
static final TextureAttachment | createColorTextureAttachment (final int internalFormat, final int width, final int height, final int dataFormat, final int dataType, final int magFilter, final int minFilter, final int wrapS, final int wrapT) |
Creates a color TextureAttachment , i.e. | |
static final RenderAttachment | createRenderAttachment (final Type type, final int internalFormat, final int samples, final int width, final int height) |
static final String | getStatusString (final int fbStatus) |
static String | toHexString (final int v) |
Static Public Attributes | |
static final int | CHOSEN_BITS = -2 |
Request current context drawable's chosen depth- or stencil- bits; value {@value}. | |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | dataFormat |
Texture FBO attachment. | |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | dataType |
static final int | DEFAULT_BITS = 0 |
Request default bit count for depth- or stencil buffer (depth 24 bits, stencil 8 bits), value {@value}. | |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | magFilter |
static final int | MAXIMUM_BITS = -3 |
Request maximum bit count for depth- or stencil buffer (depth 32 bits, stencil 16 bits), value {@value}. | |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | minFilter |
static final int | REQUESTED_BITS = -1 |
Request current context drawable's requested depth- or stencil- bits; value {@value}. | |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | wrapS |
static class ColorAttachment extends RenderAttachment implements gamp::render::gl::FBObject::Colorbuffer | wrapT |
Protected Member Functions | |
final void | attachRenderbufferImpl (final GL gl, final Attachment.Type atype, final int internalFormat) throws GLException |
Core utility class simplifying usage of framebuffer objects (FBO) with all GLProfile
s.
Supports on-the-fly reconfiguration of dimension and multisample buffers via reset(GL, int, int, int, boolean)
while preserving the Attachment
references.
Integrates default read/write framebuffers via GLContext#getDefaultReadFramebuffer()
and GLContext#getDefaultReadFramebuffer()
, which is being hooked at GL#glBindFramebuffer(int, int)
when the default (zero
) framebuffer is selected.
FIXME: Implement support for Type#DEPTH_TEXTURE
, Type#STENCIL_TEXTURE
.
Definition at line 48 of file FBObject.hpp.
|
inline |
Creates an uninitialized FBObject instance.
Call init(GL, int, int, int)
.. etc to use it.
Definition at line 953 of file FBObject.hpp.
|
inline |
type | allowed types are Type#DEPTH_STENCIL Type#DEPTH , Type#STENCIL or Type#COLOR |
iFormat | |
samples | |
width | |
height | |
name |
Definition at line 400 of file FBObject.hpp.
|
inline |
number of samples, or zero for no multisampling
Definition at line 407 of file FBObject.hpp.
|
inline |
Definition at line 408 of file FBObject.hpp.
|
inline |
|
inline |
|
inline |
Definition at line 451 of file FBObject.hpp.
|
inline |
Definition at line 490 of file FBObject.hpp.
|
inline |
Definition at line 502 of file FBObject.hpp.
|
inline |
type | allowed types are [ Type#COLOR_TEXTURE , Type#DEPTH_TEXTURE , Type#STENCIL_TEXTURE ] |
iFormat | |
width | |
height | |
dataFormat | |
dataType | |
magFilter | |
minFilter | |
wrapS | |
wrapT | |
name |
Definition at line 539 of file FBObject.hpp.
|
inline |
Initializes the texture and set it's parameter, if uninitialized, i.e.
name is zero
.
GLException | if texture generation and setup fails. The just created texture name will be deleted in this case. |
Definition at line 567 of file FBObject.hpp.
|
inline |
Definition at line 624 of file FBObject.hpp.
|
inline |
|
inline |
Definition at line 638 of file FBObject.hpp.
|
inline |
Definition at line 640 of file FBObject.hpp.
|
inline |
Definition at line 643 of file FBObject.hpp.
|
inlinestatic |
|
inlinestatic |
Creates a color TextureAttachment
, i.e.
type Type#COLOR_TEXTURE
, selecting the texture data type and format automatically.
Using default min/mag filter GL#GL_NEAREST
and default wrapS/wrapT GL#GL_CLAMP_TO_EDGE
.
gl | the used GLContext 's GL object |
alpha | set to true if you request alpha channel, otherwise false ; |
width | texture width |
height | texture height |
TextureAttachment
Definition at line 668 of file FBObject.hpp.
|
inlinestatic |
Creates a color TextureAttachment
, i.e.
type Type#COLOR_TEXTURE
, selecting the texture data type and format automatically.
For GLES3, sampling-sink format must be equal w/ the sampling-source Colorbuffer
, see details below. Implementation aligns w/ createColorAttachment(boolean)
and is enforced via sampleSinkExFormatMismatch(GL)
.
ES3 BlitFramebuffer Requirements: OpenGL ES 3.0.2 p194: 4.3.2 Copying Pixels
If SAMPLE_BUFFERS for the read framebuffer is greater than zero, no copy is performed and an INVALID_OPERATION error is generated if the formats of the read and draw framebuffers are not identical or if the source and destination rectangles are not defined with the same (X0, Y 0) and (X1, Y 1) bounds.
Texture and Renderbuffer format details:
ES2 Base iFormat: OpenGL ES 2.0.24 p66: 3.7.1 Texture Image Specification, Table 3.8 ALPHA, LUMINANCE, LUMINANCE_ALPHA, RGB, RGBA ES3 Base iFormat: OpenGL ES 3.0.2 p125: 3.8.3 Texture Image Specification, Table 3.11 ALPHA, LUMINANCE, LUMINANCE_ALPHA, RGB, RGBA DEPTH_COMPONENT, STENCIL_COMPONENT, RED, RG ES3 Required Texture and Renderbuffer iFormat: OpenGL ES 3.0.2 p126: 3.8.3 Texture Image Specification - RGBA32I, RGBA32UI, RGBA16I, RGBA16UI, RGBA8, RGBA8I, RGBA8UI, SRGB8_ALPHA8, RGB10_A2, RGB10_A2UI, RGBA4, and RGB5_A1. - RGB8 and RGB565. - RG32I, RG32UI, RG16I, RG16UI, RG8, RG8I, and RG8UI. - R32I, R32UI, R16I, R16UI, R8, R8I, and R8UI.
gl | the used GLContext 's GL object |
alpha | set to true if you request alpha channel, otherwise false ; |
width | texture width |
height | texture height |
magFilter | if > 0 value for GL#GL_TEXTURE_MAG_FILTER |
minFilter | if > 0 value for GL#GL_TEXTURE_MIN_FILTER |
wrapS | if > 0 value for GL#GL_TEXTURE_WRAP_S |
wrapT | if > 0 value for GL#GL_TEXTURE_WRAP_T |
TextureAttachment
Definition at line 717 of file FBObject.hpp.
|
inlinestatic |
Definition at line 738 of file FBObject.hpp.
|
inlinestatic |
Creates a color TextureAttachment
, i.e.
type Type#COLOR_TEXTURE
.
internalFormat | internalFormat parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
width | texture width |
height | texture height |
dataFormat | format parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
dataType | type parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
magFilter | if > 0 value for GL#GL_TEXTURE_MAG_FILTER |
minFilter | if > 0 value for GL#GL_TEXTURE_MIN_FILTER |
wrapS | if > 0 value for GL#GL_TEXTURE_WRAP_S |
wrapT | if > 0 value for GL#GL_TEXTURE_WRAP_T |
TextureAttachment
Definition at line 766 of file FBObject.hpp.
|
inline |
Return the Colorbuffer
attachment at attachmentPoint
if it is attached to this FBO, otherwise null.
Definition at line 885 of file FBObject.hpp.
|
inline |
Finds the passed Colorbuffer
within the valid range of attachment points using reference comparison only.
Note: Slow. Implementation uses a logN array search to save resources, i.e. not using a HashMap.
ca | the Colorbuffer to look for. |
Colorbuffer
could not be found, otherwise [0..getMaxColorAttachments()
-1] Definition at line 899 of file FBObject.hpp.
|
inline |
Returns the passed Colorbuffer
if it is attached to this FBO, otherwise null.
Implementation compares the reference only.
Note: Slow. Uses getColorbufferAttachmentPoint(Colorbuffer)
to determine it's attachment point to be used for getColorbuffer(int)
Definition at line 922 of file FBObject.hpp.
|
inline |
Returns true if any attached Colorbuffer
uses alpha, otherwise false.
Definition at line 931 of file FBObject.hpp.
|
inline |
Initializes this FBO's instance.
The sampling sink is not initializes, allowing manual assignment via setSamplingSink(FBObject)
if newSamples > 0
.
Leaves the FBO bound
gl | the current GL context |
newWidth | the initial width, it's minimum is capped to 1 |
newHeight | the initial height, it's minimum is capped to 1 |
newSamples | if > 0, MSAA will be used, otherwise no multisampling. Will be capped to getMaxSamples() . |
IllegalStateException | if already initialized |
GLException | in case of an error, i.e. size too big, etc .. |
Definition at line 1007 of file FBObject.hpp.
|
inline |
Resets this FBO's instance.
In case the new parameters are compatible with the current ones no action will be performed and method returns immediately.
Otherwise all attachments will be recreated to match the new given parameters.
resetSamplingSink(GL)
is being issued immediately to match the new configuration.
Leaves the FBO bound state untouched
gl | the current GL context |
newWidth | the new width, it's minimum is capped to 1 |
newHeight | the new height, it's minimum is capped to 1 |
newSamples | if > 0, MSAA will be used, otherwise no multisampling. Will be capped to getMaxSamples() . |
true
if this instance has been modified, otherwise false
. IllegalStateException | if not initialized via init(GL, int, int, int) . |
GLException | in case of an error, i.e. size too big, etc .. |
Definition at line 1139 of file FBObject.hpp.
|
inline |
Writes the internal format of the attachments to the given GLCapabilities object.
caps | the destination for format bits |
Definition at line 1239 of file FBObject.hpp.
|
inline |
Note that the status may reflect an incomplete state during transition of attachments.
GL.GL_FRAMEBUFFER_COMPLETE
if ok, otherwise return GL FBO error state or -1 Definition at line 1262 of file FBObject.hpp.
|
inline |
return the getStatus()
as a string.
Definition at line 1267 of file FBObject.hpp.
|
inlinestatic |
Definition at line 1271 of file FBObject.hpp.
|
inline |
The status may even be valid if incomplete during transition of attachments.
Definition at line 1312 of file FBObject.hpp.
|
inline |
Attaches a Colorbuffer
, i.e.
TextureAttachment
, to this FBO's instance at the given attachment point, selecting the texture data type and format automatically.
Using default min/mag filter GL#GL_NEAREST
and default wrapS/wrapT GL#GL_CLAMP_TO_EDGE
.
Leaves the FBO bound.
gl | the current GL context |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
alpha | set to true if you request alpha channel, otherwise false ; |
GLException | in case the texture colorbuffer couldn't be allocated or MSAA has been chosen |
Definition at line 1386 of file FBObject.hpp.
|
inline |
Attaches a Colorbuffer
, i.e.
TextureAttachment
, to this FBO's instance at the given attachment point, selecting the texture data type and format automatically.
Leaves the FBO bound.
gl | the current GL context |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
alpha | set to true if you request alpha channel, otherwise false ; |
magFilter | if > 0 value for GL#GL_TEXTURE_MAG_FILTER |
minFilter | if > 0 value for GL#GL_TEXTURE_MIN_FILTER |
wrapS | if > 0 value for GL#GL_TEXTURE_WRAP_S |
wrapT | if > 0 value for GL#GL_TEXTURE_WRAP_T |
GLException | in case the texture colorbuffer couldn't be allocated or MSAA has been chosen |
Definition at line 1408 of file FBObject.hpp.
|
inline |
Attaches a Colorbuffer
, i.e.
TextureAttachment
, to this FBO's instance at the given attachment point.
Leaves the FBO bound.
gl | the current GL context |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
internalFormat | internalFormat parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
dataFormat | format parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
dataType | type parameter to GL#glTexImage2D(int, int, int, int, int, int, int, int, long) |
magFilter | if > 0 value for GL#GL_TEXTURE_MAG_FILTER |
minFilter | if > 0 value for GL#GL_TEXTURE_MIN_FILTER |
wrapS | if > 0 value for GL#GL_TEXTURE_WRAP_S |
wrapT | if > 0 value for GL#GL_TEXTURE_WRAP_T |
GLException | in case the texture colorbuffer couldn't be allocated or MSAA has been chosen |
Definition at line 1431 of file FBObject.hpp.
|
inline |
Creates a ColorAttachment
, selecting the format automatically.
For GLES3, sampling-sink Colorbuffer
format must be equal w/ the sampling-source Colorbuffer
. Implementation aligns w/ createColorTextureAttachment(GLProfile, boolean, int, int, int, int, int, int)
and is enforced via sampleSinkExFormatMismatch(GL)
.
alpha | set to true if you request alpha channel, otherwise false ; |
Definition at line 1449 of file FBObject.hpp.
|
inlinestatic |
Creates a ColorAttachment
, selecting the format automatically.
For GLES3, sampling-sink Colorbuffer
format must be equal w/ the sampling-source Colorbuffer
. Implementation aligns w/ createColorTextureAttachment(GLProfile, boolean, int, int, int, int, int, int)
and is enforced via sampleSinkExFormatMismatch(GL)
.
alpha | set to true if you request alpha channel, otherwise false ; |
Definition at line 1471 of file FBObject.hpp.
|
inlinestatic |
Definition at line 1475 of file FBObject.hpp.
|
inline |
Attaches a newly created and initialized
Colorbuffer
, i.e.
a ColorAttachment
, at the given attachment point.
The ColorAttachment
is created using alpha
if true
and current sample count
and size
.
Leaves the FBO bound.
gl | the current GL context |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
alpha | set to true if you request alpha channel, otherwise false ; |
GLException | in case the colorbuffer couldn't be allocated |
Definition at line 1495 of file FBObject.hpp.
|
inline |
Attaches a newly created and initialized
Colorbuffer
, i.e.
a ColorAttachment
, at the given attachment point.
The ColorAttachment
is created using the given internalFormat
and current sample count
and size
.
Leaves the FBO bound.
gl | the current GL context |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
internalFormat | usually GL#GL_RGBA4 , GL#GL_RGB5_A1 , GL#GL_RGB565 , GL#GL_RGB8 or GL#GL_RGBA8 |
GLException | in case the colorbuffer couldn't be allocated |
IllegalArgumentException | if internalFormat doesn't reflect a colorbuffer |
Definition at line 1515 of file FBObject.hpp.
|
inline |
Attaches a Colorbuffer
at the given attachment point and initializes
it, if not done yet.
Colorbuffer
may be a ColorAttachment
or TextureAttachment
.
If Colorbuffer
is a TextureAttachment
and is uninitialized, i.e. it's texture name is zero
, a new texture name is generated and setup w/ the texture parameter.
Otherwise, i.e. texture name is not zero
, the passed TextureAttachment texA
is considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue.
Leaves the FBO bound.
gl | |
attachmentPoint | the color attachment point ranging from [0..getMaxColorAttachments() -1] |
colbuf | the to be attached Colorbuffer |
Colorbuffer
instance if bound and configured successfully, otherwise GLException is thrown GLException | in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a TextureAttachment |
Definition at line 1545 of file FBObject.hpp.
|
inline |
Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, selecting the internalFormat automatically.
Stencil and depth buffer can be attached only once.
In case the bit-count is not supported, the next available one is chosen, i.e. next higher (preferred) or lower bit-count.
Use getDepthAttachment()
and/or getStencilAttachment()
to retrieve details about the attached buffer. The details cannot be returned, since it's possible 2 buffers are being created, depth and stencil.
Leaves the FBO bound.
gl | |
atype | either Type#DEPTH , Type#STENCIL or Type#DEPTH_STENCIL |
reqBits | desired bits for depth or stencil, may use generic values DEFAULT_BITS , REQUESTED_BITS , CHOSEN_BITS or MAXIMUM_BITS . |
GLException | in case the renderbuffer couldn't be allocated or one is already attached. |
IllegalArgumentException |
Definition at line 1690 of file FBObject.hpp.
|
inline |
Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, depending on the internalFormat
.
Stencil and depth buffer can be attached only once.
Use getDepthAttachment()
and/or getStencilAttachment()
to retrieve details about the attached buffer. The details cannot be returned, since it's possible 2 buffers are being created, depth and stencil.
Leaves the FBO bound.
gl | the current GL context |
internalFormat | GL#GL_DEPTH_COMPONENT16 , GL#GL_DEPTH_COMPONENT24 , GL#GL_DEPTH_COMPONENT32 , GL#GL_STENCIL_INDEX1 , GL#GL_STENCIL_INDEX4 , GL#GL_STENCIL_INDEX8 or GL#GL_DEPTH24_STENCIL8 |
GLException | in case the renderbuffer couldn't be allocated or one is already attached. |
IllegalArgumentException |
Definition at line 1765 of file FBObject.hpp.
|
inlineprotected |
|
inline |
Detaches a Colorbuffer
, i.e.
ColorAttachment
or TextureAttachment
.
Leaves the FBO bound!
gl | |
attachmentPoint | |
dispose | true if the Colorbuffer shall be disposed |
IllegalArgumentException |
Definition at line 1856 of file FBObject.hpp.
|
inline |
gl | |
dispose | true if the Colorbuffer shall be disposed |
reqAType | Type#DEPTH , Type#DEPTH or Type#DEPTH_STENCIL |
Definition at line 1981 of file FBObject.hpp.
|
inline |
|
inline |
Detaches all ColorAttachment
s, TextureAttachment
s and RenderAttachment
s and disposes them.
Leaves the FBO bound, if initialized!
An attached sampling sink texture will be detached as well, see getSamplingTextureSink()
.
gl | the current GL context |
Definition at line 2148 of file FBObject.hpp.
|
inline |
Detaches all ColorAttachment
s and TextureAttachment
s and disposes them.
Leaves the FBO bound, if initialized!
An attached sampling sink texture will be detached as well, see getSamplingTextureSink()
.
gl | the current GL context |
Definition at line 2164 of file FBObject.hpp.
|
inline |
Detaches all TextureAttachment
s and disposes them.
Leaves the FBO bound, if initialized!
An attached sampling sink texture will be detached as well, see getSamplingTextureSink()
.
gl | the current GL context |
Definition at line 2179 of file FBObject.hpp.
|
inline |
Definition at line 2197 of file FBObject.hpp.
|
inline |
gl | the current GL context |
Definition at line 2252 of file FBObject.hpp.
|
inline |
Manually validates the MSAA sampling sink, if used.
If MSAA is being used and no sampling sink is attached via setSamplingSink(FBObject)
a new sampling sink is being created.
If the sampling sink size or attributes differs from the source, its attachments are reset to match the source.
Automatically called by reset(GL, int, int, int, boolean)
and syncSamplingSink(GL)
.
It is recommended to call this method after initializing the FBO and attaching renderbuffer etc for the 1st time if access to sampling sink resources is required.
Leaves the FBO bound state untouched
gl | the current GL context |
true
if this instance has been modified, otherwise false
. GLException | in case of an error, i.e. size too big, etc .. |
Definition at line 2344 of file FBObject.hpp.
|
inline |
Setting this FBO sampling sink.
newSamplingSink | the new and initialized FBO sampling sink to use, or null to remove current sampling sink |
GLException | if this FBO doesn't use MSAA or the given sink uses MSAA itself |
IllegalStateException | if the newSamplingSink is not null and not initialized |
Definition at line 2504 of file FBObject.hpp.
|
inline |
Bind this FBO, i.e.
bind write framebuffer to getWriteFramebuffer()
.
If multisampling is used, it sets the read framebuffer to the sampling sink getWriteFramebuffer()
.
In case you have attached more than one color buffer, you may want to setup GL2ES3#glDrawBuffers(int, int[], int)
.
gl | the current GL context |
GLException |
Definition at line 2539 of file FBObject.hpp.
|
inline |
Unbind this FBO, i.e.
bind read and write framebuffer to default, see GLBase#getDefaultDrawFramebuffer()
.
If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing an optional operating MSAA FBO, see GLBase#getDefaultReadFramebuffer()
and GLBase#getDefaultDrawFramebuffer()
gl | the current GL context |
GLException |
Definition at line 2562 of file FBObject.hpp.
|
inline |
Method simply marks this FBO unbound w/o interfering w/ the bound framebuffer as perfomed by unbind(GL)
.
Only use this method if a subsequent unbind(GL)
, use(GL, TextureAttachment)
or bind(GL)
follows on any FBO.
Definition at line 2583 of file FBObject.hpp.
|
inline |
Returns true
if framebuffer object is bound via bind(GL)
, otherwise false
.
Method verifies the bound state via GL#getBoundFramebuffer(int)
.
gl | the current GL context |
Definition at line 2594 of file FBObject.hpp.
|
inline |
Returns true
if framebuffer object is bound via bind(GL)
, otherwise false
.
Definition at line 2600 of file FBObject.hpp.
|
inline |
If multisampling is being used and flagged dirty by a previous call of bind(GL)
or after initialization, the msaa-buffers are sampled to it's sink getSamplingTextureSink()
.
Method also resets the sampling sink configuration via resetSamplingSink(GL)
if used and required.
Method is called automatically by use(GL, TextureAttachment)
.
Method always resets the framebuffer binding to default in the end. If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing an optional operating MSAA FBO, see GLBase#getDefaultReadFramebuffer()
and GLBase#getDefaultDrawFramebuffer()
In case you use this FBO w/o the GLFBODrawable
and intend to employ glReadPixels(..)
you may want to call glBindFramebuffer
(GL2ES3#GL_READ_FRAMEBUFFER
, getReadFramebuffer()
);
Leaves the FBO unbound.
gl | the current GL context |
ta | TextureAttachment to use, prev. attached w/ attachTexture2D(..) |
IllegalArgumentException |
Definition at line 2626 of file FBObject.hpp.
|
inline |
Synchronize the sampling sink
and bind the given TextureAttachment
, if not null
.
If using a TextureAttachment
and multiple texture units, ensure you call GL#glActiveTexture(int)
first!
syncSamplingSink(GL)
is being called
Leaves the FBO unbound!
gl | the current GL context |
ta | TextureAttachment to use, prev. attached w/ attachTexture2D(..) , may be null in case no TextureAttachment is used. |
IllegalArgumentException |
Definition at line 2671 of file FBObject.hpp.
|
inline |
Unbind texture, ie bind 'non' texture 0.
Leaves the FBO unbound.
Definition at line 2683 of file FBObject.hpp.
|
inline |
Definition at line 2689 of file FBObject.hpp.
|
inline |
Returns true
if renderbuffer accepts internal format GL#GL_RGB8
and GL#GL_RGBA8
, otherwise false
.
GLException | if init(GL) hasn't been called. |
Definition at line 2695 of file FBObject.hpp.
|
inline |
Returns true
if GL#GL_DEPTH_COMPONENT16
, GL#GL_DEPTH_COMPONENT24
or GL#GL_DEPTH_COMPONENT32
is supported, otherwise false
.
bits | 16, 24 or 32 bits |
GLException | if init(GL) hasn't been called. |
Definition at line 2702 of file FBObject.hpp.
|
inline |
Returns true
if GL#GL_STENCIL_INDEX1
, GL#GL_STENCIL_INDEX4
, GL#GL_STENCIL_INDEX8
or GL2GL3#GL_STENCIL_INDEX16
is supported, otherwise false
.
bits | 1, 4, 8 or 16 bits |
GLException | if init(GL) hasn't been called. |
Definition at line 2717 of file FBObject.hpp.
|
inline |
Returns true
if GL#GL_DEPTH24_STENCIL8
is supported, otherwise false
.
GLException | if init(GL) hasn't been called. |
Definition at line 2732 of file FBObject.hpp.
|
inline |
Returns the maximum number of colorbuffer attachments.
GLException | if init(GL) hasn't been called. |
Definition at line 2738 of file FBObject.hpp.
|
inline |
Definition at line 2740 of file FBObject.hpp.
|
inline |
Definition at line 2741 of file FBObject.hpp.
|
inline |
Definition at line 2744 of file FBObject.hpp.
|
inline |
Returns true
if this instance has been initialized with reset(GL, int, int)
or reset(GL, int, int, int, boolean)
, otherwise false
Definition at line 2750 of file FBObject.hpp.
|
inline |
Returns the width.
Definition at line 2752 of file FBObject.hpp.
|
inline |
Returns the height.
Definition at line 2754 of file FBObject.hpp.
|
inline |
Returns the number of samples for multisampling (MSAA).
zero if no multisampling is used.
Definition at line 2756 of file FBObject.hpp.
|
inline |
Returns the framebuffer name to render to.
Definition at line 2758 of file FBObject.hpp.
|
inline |
Returns the framebuffer name to read from.
Depending on multisampling, this may be a different framebuffer.
Definition at line 2760 of file FBObject.hpp.
|
inline |
Definition at line 2764 of file FBObject.hpp.
|
inline |
Definition at line 2766 of file FBObject.hpp.
|
inline |
Return the number of attached Colorbuffer
s.
Definition at line 2769 of file FBObject.hpp.
|
inline |
Return the number of attached TextureAttachment
s.
Definition at line 2771 of file FBObject.hpp.
|
inline |
Return the stencil RenderAttachment
attachment, if exist.
Maybe share the same Attachment#getName()
as getDepthAttachment()
, if packed depth-stencil is being used.
Definition at line 2773 of file FBObject.hpp.
|
inline |
Return the depth RenderAttachment
attachment.
Maybe share the same Attachment#getName()
as getStencilAttachment()
, if packed depth-stencil is being used.
Definition at line 2775 of file FBObject.hpp.
|
inline |
Return the complete multisampling FBObject
sink, if using multisampling.
Definition at line 2778 of file FBObject.hpp.
|
inline |
Return the multisampling Colorbuffer
sink, if using multisampling.
Definition at line 2781 of file FBObject.hpp.
|
inline |
Returns true
if the multisampling colorbuffer (msaa-buffer) has been flagged dirty by a previous call of bind(GL)
, otherwise false
.
Definition at line 2788 of file FBObject.hpp.
|
inline |
Returns true
if size, sample-count or any attachment of this instance or its sampling-sink
has been modified since last sync
, use
, reset
or resetSamplingSink
.
Otherwise method returns false
.
Definition at line 2799 of file FBObject.hpp.
|
inline |
|
inline |
Definition at line 2804 of file FBObject.hpp.
|
static |
Texture FBO attachment.
details of the texture setup
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Request default bit count for depth- or stencil buffer (depth 24 bits, stencil 8 bits), value {@value}.
Definition at line 1647 of file FBObject.hpp.
|
static |
Request current context drawable's requested depth-
or stencil-
bits; value {@value}.
Definition at line 1652 of file FBObject.hpp.
|
static |
Request current context drawable's chosen depth-
or stencil-
bits; value {@value}.
Definition at line 1657 of file FBObject.hpp.
|
static |
Request maximum bit count for depth- or stencil buffer (depth 32 bits, stencil 16 bits), value {@value}.
Definition at line 1660 of file FBObject.hpp.