public class FBObject extends Object
Constructor and Description |
---|
FBObject(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
boolean |
attachDepthBuffer(GL gl,
int depthComponentType)
Attaches one Depth Buffer to this FBO's instance.
|
boolean |
attachStencilBuffer(GL gl,
int stencilComponentType)
Attaches one Stencil Buffer to this FBO's instance.
|
int |
attachTexture2D(GL gl,
int texUnit,
int magFilter,
int minFilter,
int wrapS,
int wrapT)
Attaches a[nother] Texture2D Color Buffer to this FBO's instance,
selecting the texture data type and format automatically.
|
int |
attachTexture2D(GL gl,
int texUnit,
int textureInternalFormat,
int textureDataFormat,
int textureDataType,
int magFilter,
int minFilter,
int wrapS,
int wrapT)
Attaches a[nother] Texture2D Color Buffer to this FBO's instance,
selecting the texture data type and format automatically.
|
void |
bind(GL gl)
Bind this FBO
|
void |
destroy(GL gl) |
int |
getColorAttachmentNumber() |
int |
getDepthBuffer() |
int |
getFBName() |
int |
getHeight() |
int |
getStatus() |
String |
getStatusString() |
static String |
getStatusString(int fbStatus) |
int |
getStencilBuffer() |
int |
getTextureName(int idx) |
int |
getTextureNumber() |
int |
getTextureUnit(int idx) |
int |
getWidth() |
void |
init(GL gl)
Initializes this FBO's instance with it's texture.
|
boolean |
isBound() |
boolean |
isStatusValid() |
String |
toString() |
void |
unbind(GL gl)
Unbind FBO, ie bind 'non' FBO 0
|
void |
unuse(GL gl)
Unbind texture, ie bind 'non' texture 0
|
void |
use(GL gl,
int texIdx)
Bind the texture with given index.
|
public boolean isStatusValid()
getStatus()
public int getStatus()
GL.GL_FRAMEBUFFER_COMPLETE
if ok, otherwise return GL FBO error state or -1#validateStatus()
public String getStatusString()
public static final String getStatusString(int fbStatus)
public void init(GL gl) throws GLException
Leaves the FBO bound!
gl
- the current GL contextGLException
- in case of an errorpublic int attachTexture2D(GL gl, int texUnit, int magFilter, int minFilter, int wrapS, int wrapT) throws GLException
This may be done as many times as many color attachments are supported,
see GL2ES2.GL_MAX_COLOR_ATTACHMENTS
.
Assumes a bound FBO
Leaves the FBO bound!
gl
- the current GL contexttexUnit
- the desired texture unit ranging from [0..GL2ES1.GL_MAX_TEXTURE_UNITS
-1], or -1 if no unit shall be activate at use(GL, int)
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 of an errorpublic int attachTexture2D(GL gl, int texUnit, int textureInternalFormat, int textureDataFormat, int textureDataType, int magFilter, int minFilter, int wrapS, int wrapT) throws GLException
This may be done as many times as many color attachments are supported,
see GL2ES2.GL_MAX_COLOR_ATTACHMENTS
.
Assumes a bound FBO
Leaves the FBO bound!
gl
- the current GL contexttexUnit
- the desired texture unit ranging from [0..GL2ES1.GL_MAX_TEXTURE_UNITS
-1], or -1 if no unit shall be activate at use(GL, int)
textureInternalFormat
- internalFormat parameter to GL.glTexImage2D(int, int, int, int, int, int, int, int, long)
textureDataFormat
- format parameter to GL.glTexImage2D(int, int, int, int, int, int, int, int, long)
textureDataType
- 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 allocatedpublic boolean attachDepthBuffer(GL gl, int depthComponentType) throws GLException
This may be done only one time.
Assumes a bound FBO
Leaves the FBO bound!
gl
- the current GL contextdepthComponentType
- GL.GL_DEPTH_COMPONENT16
, GL.GL_DEPTH_COMPONENT24
or GL.GL_DEPTH_COMPONENT32
GLException
- in case the depth renderbuffer couldn't be allocated or one is already attached.public boolean attachStencilBuffer(GL gl, int stencilComponentType) throws GLException
This may be done only one time.
Assumes a bound FBO
Leaves the FBO bound!
gl
- the current GL contextstencilComponentType
- GL.GL_STENCIL_INDEX1
, GL.GL_STENCIL_INDEX4
or GL.GL_STENCIL_INDEX8
GLException
- in case the stencil renderbuffer couldn't be allocated or one is already attached.public void destroy(GL gl)
gl
- the current GL contextpublic void bind(GL gl)
In case you have attached more than one color buffer,
you may want to setup GL2GL3.glDrawBuffers(int, int[], int)
.
gl
- the current GL contextpublic void unbind(GL gl)
gl
- the current GL contextpublic void use(GL gl, int texIdx)
If a valid texture unit was named via attachTexture2D(..)
,
the unit is activated via glActiveTexture(GL.GL_TEXTURE0 + unit)
.
gl
- the current GL contexttexIdx
- index of the texture to use, prev. attached w/ attachTexture2D(..)
public void unuse(GL gl)
public final boolean isBound()
public final int getWidth()
public final int getHeight()
public final int getFBName()
public final int getTextureNumber()
public final int getTextureName(int idx)
public final int getTextureUnit(int idx)
GL2ES1.GL_MAX_TEXTURE_UNITS
-1], or -1 if no unit was desired.public final int getColorAttachmentNumber()
public final int getStencilBuffer()
public final int getDepthBuffer()
Copyright 2010 JogAmp Community.