|
Aviatrix3D 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
Describes the texture that is rendered to an offscreen buffer, using OpenGL pBuffers.
Since the format information is provided as part of the GLCapabilities instance, there is no need for it to be passed into the constructor like the other texture types do.
This implementation is somewhat shaky right now as the documentation on how to use the GLPbuffer class is very poor. The class may change drastically once we really work out what is going on.
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.
For repainting updates, the logic is as-follows. On the first time this
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.
Field Summary |
Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
lastParent, liveCount, parentList |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG |
Fields inherited from interface org.j3d.aviatrix3d.TextureSource |
FORMAT_BGR, FORMAT_BGRA, FORMAT_INTENSITY_ALPHA, FORMAT_RGB, FORMAT_RGBA, FORMAT_SINGLE_COMPONENT |
Constructor Summary | |
OffscreenTexture2D(net.java.games.jogl.GLCapabilities caps,
int width,
int height)
Constructs an offscreen texture that fits the given setup. |
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. |
net.java.games.jogl.GLPbuffer |
getBuffer(java.lang.Object obj)
Get the currently registered pBuffer for the given key object. |
void |
getClearColor(float[] col)
Set the background colour that this surface should be cleared to before the drawing step. |
int |
getFormat(int level)
Get the format for this texture. |
net.java.games.jogl.GLCapabilities |
getGLSetup()
Get the requested buffer setup that describes this offscreen texture. |
int |
getHeight()
Get the height of the texture in pixels. |
int |
getNumLevels()
Get the number of levels for the mipmapping in this source. |
Scene |
getRenderedScene()
Get the root of the currently rendered scene. |
boolean |
isRepaintRequired()
Get the current state of the repainting enabled flag. |
void |
postRender(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable |
void |
registerBuffer(java.lang.Object obj,
net.java.games.jogl.GLPbuffer buffer)
Register a pBuffer for a given key object. |
void |
render(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
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. |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setRenderedScene(Scene scene)
Set the collection of geometry that should be rendered to this texture. |
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, hasChanged, numParents, removeParent |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
checkForCyclicParent, dataChanged, 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.TextureSource |
getWidth |
Constructor Detail |
public OffscreenTexture2D(net.java.games.jogl.GLCapabilities caps, int width, int height)
Method Detail |
public void setSources(int mipMapMode, int format, TextureSource[] texSources, int num) throws InvalidWriteTimingException
setSources
in class Texture
mipMapMode
- 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 int getFormat(int level)
getFormat
in interface TextureSource
level
- The mipmap level to get the format for
public int getNumLevels()
getNumLevels
in interface TextureSource
public void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
render
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
postRender
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withprotected void checkForCyclicChild(SceneGraphObject parent) throws InvalidWriteTimingException, CyclicSceneGraphStructureException
checkForCyclicChild
in class SceneGraphObject
parent
- The reference to check against this class
CyclicSceneGraphStructureException
- Equal parent and child
InvalidWriteTimingException
protected void setLive(boolean state)
setLive
in class Texture
state
- true if this should be marked as live nowprotected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler
in class Texture
handler
- The instance to use as a handlerpublic net.java.games.jogl.GLCapabilities getGLSetup()
getGLSetup
in interface PBufferTextureSource
public net.java.games.jogl.GLPbuffer getBuffer(java.lang.Object obj)
getBuffer
in interface PBufferTextureSource
obj
- The key used to register the buffer with
public void registerBuffer(java.lang.Object obj, net.java.games.jogl.GLPbuffer buffer)
registerBuffer
in interface PBufferTextureSource
obj
- The key used to register the buffer withbuffer
- The buffer instance to use here.public void unregisterBuffer(java.lang.Object obj)
unregisterBuffer
in interface PBufferTextureSource
obj
- The key used to register the buffer withpublic Scene getRenderedScene()
getRenderedScene
in interface OffscreenTextureSource
public boolean isRepaintRequired()
isRepaintRequired
in interface OffscreenTextureSource
public int getHeight()
getHeight
in interface OffscreenTextureSource
public void setRenderedScene(Scene scene) throws CyclicSceneGraphStructureException
setRenderedScene
in interface OffscreenTextureSource
scene
- The new scene instance to use or null
CyclicSceneGraphStructureException
- Equal parent and childpublic void getClearColor(float[] col)
getClearColor
in interface OffscreenTextureSource
col
- An array of at least length 4 to copy values intopublic void setRepaintRequired(boolean enable)
enable
- true to have this repaint the next framepublic void setBoundaryModeT(int mode) throws InvalidWriteTimingException
mode
- The new mode.
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener 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 callback methodpublic int compareTo(Texture tex)
compareTo
in class Texture
tex
- The texture instance to be compared
public boolean equals(Texture tex)
equals
in class Texture
tex
- The texture instance to be compared
|
Aviatrix3D 1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |