|
Aviatrix3D 2.1.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.j3d.aviatrix3d.SceneGraphObject
org.j3d.aviatrix3d.NodeComponent
org.j3d.aviatrix3d.Texture
org.j3d.aviatrix3d.OffscreenTexture2D
public class OffscreenTexture2D
Describes the texture that is rendered to an offscreen buffer, using OpenGL frame buffer objects or pbuffers, depending on system capability.
Usage:
Since the format information is provided as part of the GLCapabilities instance, normally there is no need for it to be passed into the constructor like the other texture types do. The logic for determing the format is as follows using the depth bit values:
if the alpha is non-zero
if blue is non zero
format = RGBA
else if red is non-zero
format = intensity-alpha
else
format = alpha
else
if blue is non-zero
format = RGB
else
format = intensity
If this logic does not cover what you wish the texture to be, then there is
an overloaded constructor that can take the explicit format definition that
you wish to use. Note that if you wish to create a depth texture, this does
not cover that case and you need to explicitly set the format to
Texture.FORMAT_DEPTH_COMPONENT.
Since an offscreen rendering process has a completely different set of viewing parameters to the main scene, we have to include almost everything here as well. A complete viewing environment must be set up to deal with the texture rendering.
Note:
The current implementation does not work if you use this when using the null
sort stage. A further limitation is that if this is used as part of a
background (eg ShapeBackground) it will not be rendered correctly.
TODO:
If the scene is set but without root geometry, then the root geometry added
later, then the update handler is not correctly dealt with. It never gets
set. To overcome this, make sure you set a root group node before setting the
scene, even if it is just a proxy value.
Internationalisation Resource Names
| Field Summary |
|---|
| Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
|---|
lastParent, liveCount, parentList |
| Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
|---|
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
| Fields inherited from interface org.j3d.aviatrix3d.rendering.OffscreenBufferRenderable |
|---|
FORMAT_ALPHA, FORMAT_DEPTH_COMPONENT, FORMAT_INTENSITY, FORMAT_LUMINANCE, FORMAT_LUMINANCE_ALPHA, FORMAT_RGB, FORMAT_RGBA |
| Constructor Summary | |
|---|---|
OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height)
Constructs an offscreen texture that fits the given setup. |
|
OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height,
int format)
Constructs an offscreen texture that fits the given setup and provides a specific format that overrides the automatic determination. |
|
OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height)
Constructs an offscreen texture that fits the given setup. |
|
OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height,
int format)
Constructs an offscreen texture that fits the given setup and provides a specific format that overrides the automatic determination. |
|
| Method Summary | |
|---|---|
protected void |
checkForCyclicChild(SceneGraphObject parent)
Check to see if this node is the same reference as the passed node that is a parent of this node. |
int |
compareTo(Texture tex)
Compares this object with the specified object for order. |
boolean |
equals(Texture tex)
Compares this object with the specified object to check for equivalence. |
int |
getBoundaryModeT()
Get the current boundary handling for the S parameter. |
OffscreenBufferDescriptor |
getBuffer(java.lang.Object obj)
Get the currently registered pBuffer for the given key object. |
BufferSetupData |
getBufferSetup()
Get the requested buffer setup that describes this offscreen buffer. |
void |
getClearColor(float[] col)
Set the background colour that this surface should be cleared to before the drawing step. |
LayerCullable |
getCullableLayer(int layerIndex)
Get the cullable layer child that for the given layer index. |
OffscreenRenderTargetRenderable |
getDepthRenderable()
If a separate depth render target has been requested, return the renderable for that object now. |
int |
getFormat(int level)
Get the format for this texture. |
javax.media.opengl.GLCapabilities |
getGLSetup()
Get the requested buffer setup that describes this offscreen texture. |
int |
getHeight()
Get the height of the texture in pixels. |
void |
getLayers(Layer[] layers)
Fetch the current layers that are set. |
int |
getNumRenderTargets()
Get the number of render targets that this offscreen renderable manages. |
OffscreenBufferRenderable |
getOffscreenRenderable()
Fetch the renderable that this offscreen cullable will draw to. |
OffscreenRenderTargetRenderable |
getOwnerOffscreenRenderable()
If this is a child render target, return the owner renderable. |
OffscreenRenderTargetRenderable |
getRenderTargetRenderable(int index)
Get the child render target at the given index. |
boolean |
hasBufferResized()
Check to see if this buffer has resized since the last time it was used. |
boolean |
hasSeparateDepthRenderable()
Check to see if the depth buffer has its own separate renderable object. |
boolean |
isChildRenderTarget()
Check to see if this is a child render target of a parent multiple render target offscreen buffer. |
boolean |
isRepaintRequired()
Get the current state of the repainting enabled flag. |
int |
numCullableChildren()
Returns the number of valid cullable children to process. |
int |
numLayers()
Get the number of layers that are currently set. |
void |
postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable |
void |
registerBuffer(java.lang.Object obj,
OffscreenBufferDescriptor buffer)
Register a pBuffer for a given key object. |
void |
render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component |
void |
setBoundaryModeT(int mode)
Set the boundary handling for the T parameter. |
void |
setClearColor(float r,
float g,
float b,
float a)
Set the background colour that this surface should be cleared to before the drawing step. |
void |
setLayers(Layer[] layers,
int numLayers)
Set the collection of geometry that should be rendered to this texture. |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setRepaintRequired(boolean enable)
Set this texture as requiring a repaint for the next frame. |
void |
setSources(int mipMapMode,
int format,
TextureSource[] texSources,
int num)
Set the images for this texture, overridden to provide an empty implementation as this is handled by the pBuffer directly. |
protected void |
setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. |
void |
unregisterBuffer(java.lang.Object obj)
Remove an already registered pBuffer for a given key object. |
| Methods inherited from class org.j3d.aviatrix3d.NodeComponent |
|---|
addParent, getParents, numParents, removeParent |
| Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
|---|
checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.j3d.aviatrix3d.rendering.OffscreenBufferRenderable |
|---|
getFormat |
| Methods inherited from interface org.j3d.aviatrix3d.rendering.OffscreenRenderTargetRenderable |
|---|
getWidth |
| Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable |
|---|
equals |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Constructor Detail |
|---|
public OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height)
caps - The capabilities needed to generate the Pbuffer withwidth - The width of the texture in pixelsheight - The height of the texture in pixels
public OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height)
caps - The capabilities needed to generate the Pbuffer withunclampColorRange - true to make use of vendor-specific
extensions for floating point colour bufferswidth - The width of the texture in pixelsheight - The height of the texture in pixels
public OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
int width,
int height,
int format)
caps - The capabilities needed to generate the Pbuffer withwidth - The width of the texture in pixelsheight - The height of the texture in pixelsformat - The format to associate with this texture
public OffscreenTexture2D(javax.media.opengl.GLCapabilities caps,
boolean unclampColorRange,
int width,
int height,
int format)
caps - The capabilities needed to generate the Pbuffer withunclampColorRange - true to make use of vendor-specific
extensions for floating point colour bufferswidth - The width of the texture in pixelsheight - The height of the texture in pixelsformat - The format to associate with this texture| Method Detail |
|---|
public boolean isRepaintRequired()
isRepaintRequired in interface OffscreenCullablepublic LayerCullable getCullableLayer(int layerIndex)
getCullableLayer in interface OffscreenCullablepublic int numCullableChildren()
numCullableChildren in interface OffscreenCullablepublic OffscreenBufferRenderable getOffscreenRenderable()
getOffscreenRenderable in interface OffscreenCullable
public void setSources(int mipMapMode,
int format,
TextureSource[] texSources,
int num)
throws InvalidWriteTimingException
setSources in class TexturemipMapMode - Flag stating the type of texture mode to useformat - Image format to use for grayscale imagestexSources - The source data to use, single for base levelnum - The valid number of images to use from the array
InvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener callback methodpublic boolean equals(Texture tex)
equals in class Texturetex - The texture instance to be compared
public int getHeight()
getHeight in interface OffscreenRenderTargetRenderablepublic void getClearColor(float[] col)
getClearColor in interface OffscreenBufferRenderablecol - An array of at least length 4 to copy values intopublic javax.media.opengl.GLCapabilities getGLSetup()
getGLSetup in interface OffscreenBufferRenderablepublic int getFormat(int level)
level - The mipmap level to get the format for
public int getNumRenderTargets()
getNumRenderTargets in interface OffscreenBufferRenderablepublic OffscreenRenderTargetRenderable getRenderTargetRenderable(int index)
getRenderTargetRenderable in interface OffscreenBufferRenderableindex - The index of the target to fetch
public boolean hasSeparateDepthRenderable()
hasSeparateDepthRenderable in interface OffscreenBufferRenderablepublic OffscreenRenderTargetRenderable getDepthRenderable()
getDepthRenderable in interface OffscreenBufferRenderablepublic boolean hasBufferResized()
hasBufferResized in interface OffscreenBufferRenderablepublic BufferSetupData getBufferSetup()
getBufferSetup in interface OffscreenRenderTargetRenderablepublic boolean isChildRenderTarget()
getOwnerOffscreenRenderable() method will return the
parent of this class.
isChildRenderTarget in interface OffscreenRenderTargetRenderablepublic OffscreenRenderTargetRenderable getOwnerOffscreenRenderable()
public OffscreenBufferDescriptor getBuffer(java.lang.Object obj)
getBuffer in interface OffscreenRenderTargetRenderableobj - The key used to register the buffer with
public void registerBuffer(java.lang.Object obj,
OffscreenBufferDescriptor buffer)
registerBuffer in interface OffscreenRenderTargetRenderableobj - The key used to register the buffer withbuffer - The buffer instance to use here.public void unregisterBuffer(java.lang.Object obj)
unregisterBuffer in interface OffscreenRenderTargetRenderableobj - The key used to register the buffer withpublic void render(javax.media.opengl.GL gl)
render in interface ObjectRenderablegl - The gl context to draw withpublic void postRender(javax.media.opengl.GL gl)
postRender in interface ObjectRenderablegl - The gl context to draw with
protected void checkForCyclicChild(SceneGraphObject parent)
throws InvalidWriteTimingException,
CyclicSceneGraphStructureException
checkForCyclicChild in class SceneGraphObjectparent - The reference to check against this class
CyclicSceneGraphStructureException - Equal parent and child
InvalidWriteTimingExceptionprotected void setLive(boolean state)
setLive in class Texturestate - true if this should be marked as live nowprotected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler in class Texturehandler - The instance to use as a handler
public void setLayers(Layer[] layers,
int numLayers)
throws InvalidWriteTimingException,
CyclicSceneGraphStructureException
layers - The collection of layers, in order, to rendernumLayers - The number of valid layers to use
CyclicSceneGraphStructureException - Equal parent and child
InvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int numLayers()
public void getLayers(Layer[] layers)
throws java.lang.IllegalArgumentException
numLayers() in length. If not, this method does nothing (the
provided array will be unchanged).
layers - An array to copy the values into
java.lang.IllegalArgumentException - The array provided is too small or nullpublic void setRepaintRequired(boolean enable)
enable - true to have this repaint the next frame
public void setBoundaryModeT(int mode)
throws InvalidWriteTimingException
mode - The new mode.
InvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getBoundaryModeT()
public void setClearColor(float r,
float g,
float b,
float a)
throws InvalidWriteTimingException
r - The red component of the background clear colourg - The green component of the background clear colourb - The blue component of the background clear coloura - The alpha component of the background clear colour
InvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int compareTo(Texture tex)
compareTo in class Texturetex - The texture instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||