j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Texture

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.Texture
All Implemented Interfaces:
java.lang.Comparable, DeletableSceneGraphObject
Direct Known Subclasses:
OffscreenTexture2D, Texture1D, Texture2D, Texture3D, TextureCubicEnvironmentMap

public abstract class Texture
extends NodeComponent
implements DeletableSceneGraphObject, java.lang.Comparable

Describes the basic textured appearance of an object.

This is the base class for all texture objects used in Aviatrix3D. It does not provide any functional capabilities, just a collection of the common constants and state. It provides abilities based on the minimal setup for a 1-dimensional texture. For settings for addtional dimensions (T and R) please visit the appropriate derived class.

All textures default to the following setup during the constructor call:

Version:
$Revision: 1.21 $
Author:
Alan Hudson

Field Summary
static int ANISOTROPIC_MODE_NONE
          Disable anisotropic filtering
static int ANISOTROPIC_MODE_SINGLE
          Enable anisotropic filtering
protected  float anisotropicDegree
          The Anisotropic Filtering Degree
protected  int anisotropicMode
          The Anisotropic Filtering Mode
static int BM_CLAMP
          Boundary mode to clamp textures
static int BM_CLAMP_TO_BOUNDARY
          Boundary mode to clamp the texture border colour
static int BM_CLAMP_TO_EDGE
          Boundary mode to clamp the texture edge value without border
static int BM_WRAP
          Boundary mode to repeat textures
protected  int boundaryModeS
          The boundary mode S value
protected  java.util.HashMap displayListMap
          A mapping between glContext and displayListID(Integer)
protected  int format
          The pixel format of the main texture image.
static int FORMAT_ALPHA
          Interpret the texture format as alpha only
static int FORMAT_INTENSITY
          Interpret the texture format as intensity only
static int FORMAT_INTENSITY_ALPHA
          Interpret the texture format as intensity-alpha
static int FORMAT_RGB
          Interpret the texture format as RGB
static int FORMAT_RGBA
          Interpret the texture format as RGBA
protected  TextureComponent[] images
          The images defining this texture
protected  int magFilter
          The magnification filter
static int MAGFILTER_BASE_LEVEL_LINEAR
          Set the maginification filter to linear filtering
static int MAGFILTER_BASE_LEVEL_POINT
          Set the maginification filter to base point-base filtering
static int MAGFILTER_FASTEST
          Set the maginification filter to the fastest option
static int MAGFILTER_LINEAR_DETAIL
          Set the maginfication filter to use the detail texture option
static int MAGFILTER_LINEAR_DETAIL_ALPHA
          Set the maginfication filter to use the detail texture's alpha values
static int MAGFILTER_LINEAR_DETAIL_RGB
          Set the maginfication filter to use the detail texture's RGB values
static int MAGFILTER_NICEST
          Set the maginification filter to the highest quality option
protected  int minFilter
          The minification filter
static int MINFILTER_BASE_LEVEL_LINEAR
          Set the mininification filter to linear filtering
static int MINFILTER_BASE_LEVEL_POINT
          Set the mininification filter to base point-base filtering
static int MINFILTER_FASTEST
          Set the minification filter to the fastest option
static int MINFILTER_MULTI_LEVEL_LINEAR
          Set the mininification filter to linear filtering
static int MINFILTER_MULTI_LEVEL_POINT
          Set the mininification filter to base point-base filtering
static int MINFILTER_NICEST
          Set the mininification filter to the highest quality option
protected  int mipMapMode
          The mipMapMode
static int MODE_BASE_LEVEL
          MipMapMode constants - No Mip Map
static int MODE_MIPMAP
          MipMapMode constants - Use Mip Maps
protected  int numImages
          The number of valid items in the image array
protected  boolean stateChanged
          Flag to say that the display lists must be cleared and regenerated because some state changed
protected  java.util.HashMap textureIdMap
          The mapping of GL context to OpenGL texture ID
protected  int textureType
          The GL type of the texture.
protected  int width
          The width of the main texture.
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
protected Texture(int type)
          Constructs a texture with default values.
 
Method Summary
 void cleanup(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Cleanup the object now for the given GL context.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(Texture tex)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 boolean equals(Texture tex)
          Compares this object with the specified object to check for equivalence.
 float getAnisotropicFilterDegree()
          Get the current anisotropic filtering degree.
 int getAnisotropicFilterMode()
          Get the current aniostropic filtering mode.
 int getBoundaryModeS()
          Get the current boundary handling for the S parameter.
 int getFormat()
          Get the format for this texture.
 int getMagFilter()
          Get the magnification filtering mode.
 int getMinFilter()
          Get the minification filtering mode.
 int getTextureType()
          Get the texture type.
 int getWidth()
          Get the width of the texture in pixels.
 void setAnisotropicFilterDegree(float degree)
          Set the anisotropic filtering degree.
 void setAnisotropicFilterMode(int mode)
          Set the aniostropic filtering mode.
 void setBoundaryModeS(int mode)
          Set the boundary handling for the S parameter.
 void setImages(int mipMapMode, int format, TextureComponent[] srcImages, int num)
          Set the images for this texture
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setMagFilter(int mode)
          Set the magnification filtering mode.
 void setMinFilter(int mode)
          Set the magnification filtering mode.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent, renderState, restoreState
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_BASE_LEVEL

public static final int MODE_BASE_LEVEL
MipMapMode constants - No Mip Map

See Also:
Constant Field Values

MODE_MIPMAP

public static final int MODE_MIPMAP
MipMapMode constants - Use Mip Maps

See Also:
Constant Field Values

BM_WRAP

public static final int BM_WRAP
Boundary mode to repeat textures

See Also:
Constant Field Values

BM_CLAMP

public static final int BM_CLAMP
Boundary mode to clamp textures

See Also:
Constant Field Values

BM_CLAMP_TO_EDGE

public static final int BM_CLAMP_TO_EDGE
Boundary mode to clamp the texture edge value without border

See Also:
Constant Field Values

BM_CLAMP_TO_BOUNDARY

public static final int BM_CLAMP_TO_BOUNDARY
Boundary mode to clamp the texture border colour

See Also:
Constant Field Values

MAGFILTER_FASTEST

public static final int MAGFILTER_FASTEST
Set the maginification filter to the fastest option

See Also:
Constant Field Values

MAGFILTER_NICEST

public static final int MAGFILTER_NICEST
Set the maginification filter to the highest quality option

See Also:
Constant Field Values

MAGFILTER_BASE_LEVEL_POINT

public static final int MAGFILTER_BASE_LEVEL_POINT
Set the maginification filter to base point-base filtering

See Also:
Constant Field Values

MAGFILTER_BASE_LEVEL_LINEAR

public static final int MAGFILTER_BASE_LEVEL_LINEAR
Set the maginification filter to linear filtering

See Also:
Constant Field Values

MAGFILTER_LINEAR_DETAIL

public static final int MAGFILTER_LINEAR_DETAIL
Set the maginfication filter to use the detail texture option

See Also:
Constant Field Values

MAGFILTER_LINEAR_DETAIL_RGB

public static final int MAGFILTER_LINEAR_DETAIL_RGB
Set the maginfication filter to use the detail texture's RGB values

See Also:
Constant Field Values

MAGFILTER_LINEAR_DETAIL_ALPHA

public static final int MAGFILTER_LINEAR_DETAIL_ALPHA
Set the maginfication filter to use the detail texture's alpha values

See Also:
Constant Field Values

MINFILTER_FASTEST

public static final int MINFILTER_FASTEST
Set the minification filter to the fastest option

See Also:
Constant Field Values

MINFILTER_NICEST

public static final int MINFILTER_NICEST
Set the mininification filter to the highest quality option

See Also:
Constant Field Values

MINFILTER_BASE_LEVEL_POINT

public static final int MINFILTER_BASE_LEVEL_POINT
Set the mininification filter to base point-base filtering

See Also:
Constant Field Values

MINFILTER_BASE_LEVEL_LINEAR

public static final int MINFILTER_BASE_LEVEL_LINEAR
Set the mininification filter to linear filtering

See Also:
Constant Field Values

MINFILTER_MULTI_LEVEL_POINT

public static final int MINFILTER_MULTI_LEVEL_POINT
Set the mininification filter to base point-base filtering

See Also:
Constant Field Values

MINFILTER_MULTI_LEVEL_LINEAR

public static final int MINFILTER_MULTI_LEVEL_LINEAR
Set the mininification filter to linear filtering

See Also:
Constant Field Values

ANISOTROPIC_MODE_NONE

public static final int ANISOTROPIC_MODE_NONE
Disable anisotropic filtering

See Also:
Constant Field Values

ANISOTROPIC_MODE_SINGLE

public static final int ANISOTROPIC_MODE_SINGLE
Enable anisotropic filtering

See Also:
Constant Field Values

FORMAT_ALPHA

public static final int FORMAT_ALPHA
Interpret the texture format as alpha only

See Also:
Constant Field Values

FORMAT_INTENSITY

public static final int FORMAT_INTENSITY
Interpret the texture format as intensity only

See Also:
Constant Field Values

FORMAT_INTENSITY_ALPHA

public static final int FORMAT_INTENSITY_ALPHA
Interpret the texture format as intensity-alpha

See Also:
Constant Field Values

FORMAT_RGB

public static final int FORMAT_RGB
Interpret the texture format as RGB

See Also:
Constant Field Values

FORMAT_RGBA

public static final int FORMAT_RGBA
Interpret the texture format as RGBA

See Also:
Constant Field Values

images

protected TextureComponent[] images
The images defining this texture


numImages

protected int numImages
The number of valid items in the image array


anisotropicMode

protected int anisotropicMode
The Anisotropic Filtering Mode


anisotropicDegree

protected float anisotropicDegree
The Anisotropic Filtering Degree


magFilter

protected int magFilter
The magnification filter


minFilter

protected int minFilter
The minification filter


boundaryModeS

protected int boundaryModeS
The boundary mode S value


mipMapMode

protected int mipMapMode
The mipMapMode


width

protected int width
The width of the main texture.


format

protected int format
The pixel format of the main texture image.


stateChanged

protected boolean stateChanged
Flag to say that the display lists must be cleared and regenerated because some state changed


displayListMap

protected java.util.HashMap displayListMap
A mapping between glContext and displayListID(Integer)


textureType

protected final int textureType
The GL type of the texture.


textureIdMap

protected java.util.HashMap textureIdMap
The mapping of GL context to OpenGL texture ID

Constructor Detail

Texture

protected Texture(int type)
Constructs a texture with default values. The mipmap mode is set to MODE_BASE_LEVEL.

Parameters:
type - One of the texture type constants
Method Detail

setLive

protected void setLive(boolean state)
Notification that this object is live now.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

cleanup

public void cleanup(net.java.games.jogl.GL gl,
                    net.java.games.jogl.GLU glu)
Cleanup the object now for the given GL context.

Specified by:
cleanup in interface DeletableSceneGraphObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Derived instances should override this to add texture-specific extensions.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Parameters:
o - The object to be compared
Returns:
True if these represent the same values

setImages

public void setImages(int mipMapMode,
                      int format,
                      TextureComponent[] srcImages,
                      int num)
               throws InvalidWriteTimingException
Set the images for this texture

Parameters:
mipMapMode - Flag stating the type of texture mode to use
format - Image format to use for grayscale images
srcImages - The image data to use, single for base level
num - The valid number of images to use from the array
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getTextureType

public int getTextureType()
Get the texture type. This returns one of the GL constant types that represent the texture type - 1D, 2D, etc.

Returns:
The type constant of this texture

getFormat

public int getFormat()
Get the format for this texture.

Returns:
The format.

getWidth

public int getWidth()
Get the width of the texture in pixels. If no image is set, this returns -1.

Returns:
a number >= -1

setAnisotropicFilterMode

public void setAnisotropicFilterMode(int mode)
                              throws InvalidWriteTimingException
Set the aniostropic filtering mode.

Parameters:
mode - The new mode.
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getAnisotropicFilterMode

public int getAnisotropicFilterMode()
Get the current aniostropic filtering mode.

Returns:
The current mode.

setAnisotropicFilterDegree

public void setAnisotropicFilterDegree(float degree)
                                throws InvalidWriteTimingException
Set the anisotropic filtering degree. Values greater then the hardware supports will be clamped.

Parameters:
degree - The filtering degree. 1.0 is the default.
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getAnisotropicFilterDegree

public float getAnisotropicFilterDegree()
Get the current anisotropic filtering degree. The value returned will be the clamped maximum for the hardware support.

Returns:
The filtering degree. 1.0 is the default.

setMagFilter

public void setMagFilter(int mode)
                  throws InvalidWriteTimingException
Set the magnification filtering mode.

Parameters:
mode - The new mode.
Throws:
InvalidWriteTimingException

getMagFilter

public int getMagFilter()
Get the magnification filtering mode.

Returns:
The current mode.

setMinFilter

public void setMinFilter(int mode)
                  throws InvalidWriteTimingException
Set the magnification filtering mode.

Parameters:
mode - The new mode.
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getMinFilter

public int getMinFilter()
Get the minification filtering mode.

Returns:
The current mode.

setBoundaryModeS

public void setBoundaryModeS(int mode)
                      throws InvalidWriteTimingException
Set the boundary handling for the S parameter.

Parameters:
mode - The new mode.
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getBoundaryModeS

public int getBoundaryModeS()
Get the current boundary handling for the S parameter.

Returns:
The current mode.

compareTo

public int compareTo(Texture tex)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Derived instances should override this to add texture-specific extensions.

Parameters:
tex - The texture instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(Texture tex)
Compares this object with the specified object to check for equivalence.

Parameters:
tex - The texture instance to be compared
Returns:
true if the objects represent identical values

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org