public class DistortedFramebuffer
extends org.distorted.library.main.InternalOutputSurface
User is able to create offscreen FBOs and both a) render to them b) use their COLOR0 attachment as an input texture. Attaching Depths and/or Stencils is also possible.
Constructor and Description |
---|
DistortedFramebuffer(int width,
int height,
int numcolors,
int depthStencil)
Create new offscreen Framebuffer with configurable number of COLOR, DEPTH and STENCIL attachments.
|
Modifier and Type | Method and Description |
---|---|
void |
bindForOutput(int texture)
Attach the texture'th Texture to COLOR0 attachment.
|
void |
enableDepthStencil(int depthStencil)
Enable.disable DEPTH and STENCIL buffers.
|
long |
getID()
Return unique ID of this Object.
|
int |
getTextureID()
Return the ID of the Texture (COLOR attachment 0) that's backing this FBO.
|
void |
markForDeletion()
Mark the underlying OpenGL object for deletion.
|
boolean |
setAsInput(int texture)
Bind the underlying rectangle of pixels as a OpenGL Texture.
|
attach, attach, detach, detach, detachAll, getFOV, getHeight, getNear, getWidth, glClear, glClearColor, glClearDepthf, glClearStencil, hasDepth, hasStencil, render, render, resize, setAsOutput, setMipmap, setOrderIndependentTransparency, setOrderIndependentTransparency, setProjection
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
adjustIsomorphism
public DistortedFramebuffer(int width, int height, int numcolors, int depthStencil)
width
- Width of all the COLOR attachments.height
- Height of all the COLOR attachments.numcolors
- How many COLOR attachments to create?depthStencil
- Add DEPTH or STENCIL attachment?
Valid values: NO_DEPTH_NO_STENCIL, DEPTH_NO_STENCIL, BOTH_DEPTH_STENCIL.public boolean setAsInput(int texture)
texture
- The Texture number to bind (and thus read from).true
if successful.public void bindForOutput(int texture)
texture
- The Texture number to attach (and subsequently use to render to)public void enableDepthStencil(int depthStencil)
depthStencil
- Valid values: NO_DEPTH_NO_STENCIL, DEPTH_NO_STENCIL, BOTH_DEPTH_STENCIL.public int getTextureID()
Catch: this will only work if the library has had time to actually create the texture. Remember that the texture gets created only on first render, thus creating a Texture object and immediately calling this method will return an invalid (negative) result.
public void markForDeletion()
public long getID()