|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.renderer.TextureRenderer
public class TextureRenderer
Provides render-to-texture functionality using various methods according to the abilities of the driver.
| Nested Class Summary | |
|---|---|
protected static class |
TextureRenderer.InstanceKey
Identifies a shared texture renderer instance. |
| Field Summary | |
|---|---|
protected Texture |
_color
The color and/or depth textures to which we render. |
protected GlContext |
_ctx
The renderer context. |
protected Texture |
_depth
The color and/or depth textures to which we render. |
protected Framebuffer |
_framebuffer
The frame buffer object, if supported. |
protected int |
_height
The width and height of the render surface. |
protected static SoftCache<TextureRenderer.InstanceKey,TextureRenderer> |
_instances
The shared texture renderer instances. |
protected int |
_level
The mipmap level. |
protected boolean |
_matchTextureDimensions
If true, change the render surface dimensions to match the texture dimensions. |
protected Framebuffer |
_obuffer
The originally bound frame buffer. |
protected int |
_odraw
The original draw and read buffers. |
protected int |
_oread
The original draw and read buffers. |
protected Renderer |
_orenderer
The original context renderer. |
protected Rectangle |
_oviewport
The original viewport. |
protected int |
_param
The cube map face index or z offset, as appropriate. |
protected Pbuffer |
_pbuffer
The pbuffer object, if supported. |
protected PixelFormat |
_pformat
The requested pixel format. |
protected int |
_pheight
The dimensions of the Pbuffer. |
protected int |
_pwidth
The dimensions of the Pbuffer. |
protected Renderer |
_renderer
The renderer with which we render. |
protected RenderTexture |
_rtex
The render-to-texture configuration. |
protected int |
_width
The width and height of the render surface. |
| Constructor Summary | |
|---|---|
TextureRenderer(GlContext ctx,
Texture color,
Texture depth,
int width,
int height,
PixelFormat pformat)
Creates a new texture renderer to render into the specified texture(s). |
|
| Method Summary | |
|---|---|
protected void |
bindTextures()
Binds the texture(s) to the pbuffer. |
void |
commitRender()
Stops rendering to the texture (and makes it available for use). |
protected void |
copyTexture(Texture texture)
Copies a single texture from the buffer. |
protected void |
copyTextures()
Copies the textures from the buffer. |
protected static void |
deleteFramebuffer(Framebuffer framebuffer)
Deletes the specified frame buffer and its render buffer attachments. |
void |
dispose()
Disposes of this texture renderer, rendering it unusable. |
protected void |
finalize()
|
Texture |
getColor()
Returns a reference to the color texture (if any). |
Texture |
getDepth()
Returns a reference to the depth texture (if any). |
protected static int |
getDepthFormat(int bits)
Returns the depth format with the specified number of bits. |
int |
getHeight()
Returns the configured height of the renderer. |
static TextureRenderer |
getInstance(GlContext ctx,
Texture color,
Texture depth,
int width,
int height,
PixelFormat pformat)
Retrieves the shared texture renderer instance for the supplied textures. |
static TextureRenderer |
getInstance(GlContext ctx,
Texture color,
Texture depth,
PixelFormat pformat)
Retrieves the shared texture renderer instance for the supplied textures. |
protected static int |
getRenderTextureTarget(int target)
Returns the render texture target corresponding to the specified texture target. |
protected static int |
getStencilFormat(int bits)
Returns the stencil format with the specified number of bits. |
int |
getWidth()
Returns the configured width of the renderer. |
protected void |
initPbuffer()
(Re)initializes the pbuffer. |
protected static void |
maybeDeleteAttachment(Object attachment)
Deletes the supplied attachment if it is a Renderbuffer. |
protected void |
releaseTextures()
Releases the texture(s) from the pbuffer. |
protected void |
resize(int width,
int height)
Resizes the texture render state to match the supplied dimensions. |
void |
startRender()
Starts rendering to the texture. |
void |
startRender(int level,
int param)
Starts rendering to the texture. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GlContext _ctx
protected Renderer _renderer
protected int _width
protected int _height
protected boolean _matchTextureDimensions
protected PixelFormat _pformat
protected Texture _color
protected Texture _depth
protected Framebuffer _framebuffer
protected int _pwidth
protected int _pheight
protected RenderTexture _rtex
protected Pbuffer _pbuffer
protected int _level
protected int _param
protected Rectangle _oviewport
protected Framebuffer _obuffer
protected Renderer _orenderer
protected int _odraw
protected int _oread
protected static SoftCache<TextureRenderer.InstanceKey,TextureRenderer> _instances
| Constructor Detail |
|---|
public TextureRenderer(GlContext ctx,
Texture color,
Texture depth,
int width,
int height,
PixelFormat pformat)
width - the width of the render surface, or -1 to match the texture dimensions.height - the height of the render surface, or -1.| Method Detail |
|---|
public static TextureRenderer getInstance(GlContext ctx,
Texture color,
Texture depth,
PixelFormat pformat)
public static TextureRenderer getInstance(GlContext ctx,
Texture color,
Texture depth,
int width,
int height,
PixelFormat pformat)
width - the width of the render surface, or -1 to match the texture dimensions.height - the height of the render surface, or -1.public int getWidth()
public int getHeight()
public Texture getColor()
public Texture getDepth()
public void startRender()
public void startRender(int level,
int param)
level - the mipmap level.param - the cube map face index or z offset, as appropriate.public void commitRender()
public void dispose()
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
protected void resize(int width,
int height)
protected void initPbuffer()
protected void bindTextures()
protected void releaseTextures()
protected void copyTextures()
protected void copyTexture(Texture texture)
protected static int getDepthFormat(int bits)
protected static int getStencilFormat(int bits)
protected static int getRenderTextureTarget(int target)
protected static void deleteFramebuffer(Framebuffer framebuffer)
protected static void maybeDeleteAttachment(Object attachment)
Renderbuffer.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||