public class TLspTextureRenderTarget extends Object implements ILspRenderTarget
First pass: render to render target
view.pushRenderTarget(target); // perform GL rendering to the render target view.popRenderTarget(target);Second pass: use render target's texture
target.useColorTexture(view.getGLDrawable()); // Draw screen-space quad.
Constructor and Description |
---|
TLspTextureRenderTarget(int aWidth,
int aHeight,
int aMSAASamples,
boolean aWithDepthStencilBuffer)
Constructs a render target with the given dimensions and an internal representation
that matches the main view.
|
TLspTextureRenderTarget(int aWidth,
int aHeight,
int aTextureInternalFormat,
int aTextureDataFormat,
int aTextureDataType,
int aMSAASamples,
boolean aWithDepthStencilBuffer)
Constructs a render target with the given dimensions and a custom internal representation.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(ILcdGLDrawable aGLDrawable)
Binds the render target for use.
|
void |
destroy(ILcdGLDrawable aGLDrawable)
Destroys the render target.
|
int |
getColorTextureName()
Gets the texture id.
|
int |
getFBObjectName()
Gets the OpenGL frame buffer object
that is used by this render target.
|
int |
getHeight()
Gets the height in pixels of this render target.
|
int |
getTarget()
Returns
ILcdGL.GL_TEXTURE_2D |
int |
getWidth()
Gets the width in pixels of this render target.
|
void |
init(ILcdGLDrawable aGLDrawable)
Initializes the render target.
|
void |
unbind(ILcdGLDrawable aGLDrawable)
Unbinds the render target.
|
void |
useColorTexture(ILcdGLDrawable aGLDrawable)
Binds the texture for use.
|
public TLspTextureRenderTarget(int aWidth, int aHeight, int aMSAASamples, boolean aWithDepthStencilBuffer)
aWidth
- the width of the offscreen render targetaHeight
- the height of the offscreen render targetaMSAASamples
- the number of samples to use for multi-sampling anti-aliasing.
The values 1,2,4 are common.aWithDepthStencilBuffer
- whether to use a combined depth-stencil bufferIllegalArgumentException
- if the width, height, or number of samples
is negative (zero inclusive).public TLspTextureRenderTarget(int aWidth, int aHeight, int aTextureInternalFormat, int aTextureDataFormat, int aTextureDataType, int aMSAASamples, boolean aWithDepthStencilBuffer)
aWidth
- the width of the offscreen render targetaHeight
- the height of the offscreen render targetaTextureInternalFormat
- the internal texture format (e.g., ILcdGL.GL_RGBA8
)aTextureDataFormat
- the texture data format (e.g., ILcdGL.GL_RGBA
)aTextureDataType
- the texture data type (e.g., ILcdGL.GL_UNSIGNED_BYTE
)aMSAASamples
- the number of samples to use for multi-sampling anti-aliasing.
The values 1,2,4 are common.aWithDepthStencilBuffer
- whether to use a combined depth-stencil bufferIllegalArgumentException
- if the width, height, or number of samples
is negative (zero inclusive).public void init(ILcdGLDrawable aGLDrawable)
ILspRenderTarget
init
in interface ILspRenderTarget
aGLDrawable
- the drawable for which the render target will be usedpublic int getFBObjectName()
public int getWidth()
public int getHeight()
public void destroy(ILcdGLDrawable aGLDrawable)
ILspRenderTarget
destroy
in interface ILspRenderTarget
aGLDrawable
- the drawable for which the render target will be usedpublic void bind(ILcdGLDrawable aGLDrawable)
ILspRenderTarget
render target stack
's
push mechanism
instead.bind
in interface ILspRenderTarget
aGLDrawable
- the drawable for which the render target will be usedpublic int getColorTextureName()
public void unbind(ILcdGLDrawable aGLDrawable)
ILspRenderTarget
render target stack
's pop mechanism
instead.unbind
in interface ILspRenderTarget
aGLDrawable
- the drawable for which the render target will be usedpublic void useColorTexture(ILcdGLDrawable aGLDrawable)
TLspRenderTargetStack.pushRenderTarget(ILspRenderTarget)
and TLspRenderTargetStack.popRenderTarget()
) and by later
on using the resulting texture, e.g., applied to a screen-aligned quad. This method
binds the resulting texture for use, it does not bind the render target.aGLDrawable
- the drawable this texture will be used onpublic int getTarget()
ILcdGL.GL_TEXTURE_2D
ILcdGL.GL_TEXTURE_2D