Package javax.media.j3d
Class Texture2D
java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.NodeComponent
javax.media.j3d.Texture
javax.media.j3d.Texture2D
Texture2D is a subclass of Texture class. It extends Texture
class by adding a constructor and a mutator method for
setting a 2D texture image.
Note that as of Java 3D 1.5, the texture width and height are no longer required to be an exact power of two. However, not all graphics devices supports non-power-of-two textures. If non-power-of-two texture mapping is unsupported on a particular Canvas3D, textures with a width or height that are not an exact power of two are ignored for that canvas.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.static final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.static final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.static final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.static final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.static final int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.Fields inherited from class javax.media.j3d.Texture
ALLOW_ANISOTROPIC_FILTER_READ, ALLOW_BOUNDARY_COLOR_READ, ALLOW_BOUNDARY_MODE_READ, ALLOW_ENABLE_READ, ALLOW_ENABLE_WRITE, ALLOW_FILTER_READ, ALLOW_FILTER4_READ, ALLOW_FORMAT_READ, ALLOW_IMAGE_READ, ALLOW_IMAGE_WRITE, ALLOW_LOD_RANGE_READ, ALLOW_LOD_RANGE_WRITE, ALLOW_MIPMAP_MODE_READ, ALLOW_SHARPEN_TEXTURE_READ, ALLOW_SIZE_READ, ALPHA, ANISOTROPIC_NONE, ANISOTROPIC_SINGLE_VALUE, BASE_LEVEL, BASE_LEVEL_LINEAR, BASE_LEVEL_POINT, CLAMP, CLAMP_TO_BOUNDARY, CLAMP_TO_EDGE, FASTEST, FILTER4, INTENSITY, LINEAR_SHARPEN, LINEAR_SHARPEN_ALPHA, LINEAR_SHARPEN_RGB, LUMINANCE, LUMINANCE_ALPHA, MULTI_LEVEL_LINEAR, MULTI_LEVEL_MIPMAP, MULTI_LEVEL_POINT, NICEST, RGB, RGBA, WRAP
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a texture object using default values.Texture2D
(int mipMapMode, int format, int width, int height) Constructs an empty Texture2D object with specified mipmapMode format, width and height.Texture2D
(int mipMapMode, int format, int width, int height, int boundaryWidth) Constructs an empty Texture2D object with specified mipMapMode, format, width, height, and boundaryWidth. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.replaced with cloneNodeComponent(boolean forceDuplicate)void
duplicateNodeComponent
(NodeComponent originalNodeComponent) Deprecated.replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
getDetailTextureFunc
(float[] lod, float[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
getDetailTextureFunc
(javax.vecmath.Point2f[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.int
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setDetailImage
(ImageComponent2D detailTexture) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setDetailTextureFunc
(float[] lod, float[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setDetailTextureFunc
(javax.vecmath.Point2f[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setDetailTextureLevel
(int level) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setDetailTextureMode
(int mode) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.void
setMagFilter
(int magFilter) Sets the magnification filter function.Methods inherited from class javax.media.j3d.Texture
getAnisotropicFilterDegree, getAnisotropicFilterMode, getBaseLevel, getBoundaryColor, getBoundaryModeS, getBoundaryModeT, getBoundaryWidth, getEnable, getFilter4Func, getFilter4FuncPointsCount, getFormat, getHeight, getImage, getImages, getLodOffset, getMagFilter, getMaximumLevel, getMaximumLOD, getMinFilter, getMinimumLOD, getMipMapMode, getSharpenTextureFunc, getSharpenTextureFunc, getSharpenTextureFuncPointsCount, getWidth, numMipMapLevels, setAnisotropicFilterDegree, setAnisotropicFilterMode, setBaseLevel, setBoundaryColor, setBoundaryColor, setBoundaryModeS, setBoundaryModeT, setEnable, setFilter4Func, setImage, setImages, setLodOffset, setLodOffset, setMaximumLevel, setMaximumLOD, setMinFilter, setMinimumLOD, setMipMapMode, setSharpenTextureFunc, setSharpenTextureFunc
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
Field Details
-
ALLOW_DETAIL_TEXTURE_READ
public static final int ALLOW_DETAIL_TEXTURE_READDeprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Specifies that this Texture object allows reading its detail texture information (e.g., detail texture image, detail texture mode, detail texture function, detail texture function points count, detail texture level)- Since:
- Java 3D 1.3
- See Also:
-
LINEAR_DETAIL
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Performs linear sampling in both the base level texture image and the detail texture image, and combines the two texture values according to the detail texture mode.- Since:
- Java 3D 1.3
- See Also:
-
LINEAR_DETAIL_RGB
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Performs linear detail for the rgb components only. The alpha component is computed using BASE_LEVEL_LINEAR filter.- Since:
- Java 3D 1.3
- See Also:
-
LINEAR_DETAIL_ALPHA
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Performs linear detail for the alpha component only. The rgb components are computed using BASE_LEVEL_LINEAR filter.- Since:
- Java 3D 1.3
- See Also:
-
DETAIL_ADD
public static final int DETAIL_ADDDeprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Adds the detail texture image to the level 0 image of this texture object- Since:
- Java 3D 1.3
- See Also:
-
DETAIL_MODULATE
public static final int DETAIL_MODULATEDeprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported. Modulates the detail texture image with the level 0 image of this texture object- Since:
- Java 3D 1.3
- See Also:
-
-
Constructor Details
-
Texture2D
public Texture2D()Constructs a texture object using default values. The default values are as follows:-
detail texture image: null
detail texture mode: DETAIL_MODULATE
detail texture func: null
detail texture level: 2
Note that the default constructor creates a texture object with a width and height of 0 and is, therefore, not useful.
-
Texture2D
public Texture2D(int mipMapMode, int format, int width, int height) Constructs an empty Texture2D object with specified mipmapMode format, width and height. Image at base level must be set by the application using 'setImage' method. If mipmapMode is set to MULTI_LEVEL_MIPMAP, images for base level through maximum level must be set. Note that a texture with a non-power-of-two width or height will only be rendered on a graphics device that supports non-power-of-two textures.- Parameters:
mipMapMode
- type of mipmap for this Texture: One of BASE_LEVEL, MULTI_LEVEL_MIPMAP.format
- data format of Textures saved in this object. One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBA.width
- width of image at level 0.height
- height of image at level 0.- Throws:
IllegalArgumentException
- if width or height are NOT greater than 0 OR invalid format/mipmapMode is specified.
-
Texture2D
public Texture2D(int mipMapMode, int format, int width, int height, int boundaryWidth) Constructs an empty Texture2D object with specified mipMapMode, format, width, height, and boundaryWidth. Defaults are used for all other parameters. IfmipMapMode
is set toBASE_LEVEL
, then the image at level 0 must be set by the application (using either thesetImage
orsetImages
method). IfmipMapMode
is set toMULTI_LEVEL_MIPMAP
, then images for levels Base Level through Maximum Level must be set. Note that a texture with a non-power-of-two width or height will only be rendered on a graphics device that supports non-power-of-two textures.- Parameters:
mipMapMode
- type of mipmap for this Texture: one of BASE_LEVEL, MULTI_LEVEL_MIPMAPformat
- data format of Textures saved in this object. One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBAwidth
- width of image at level 0. This does not include the width of the boundary.height
- height of image at level 0. This does not include the width of the boundary.boundaryWidth
- width of the boundary, which must be 0 or 1.- Throws:
IllegalArgumentException
- if width or height are not greater than 0, if an invalid format or mipMapMode is specified, or if the boundaryWidth is < 0 or > 1- Since:
- Java 3D 1.3
-
-
Method Details
-
setMagFilter
public void setMagFilter(int magFilter) Sets the magnification filter function. This function is used when the pixel being rendered maps to an area less than or equal to one texel.- Overrides:
setMagFilter
in classTexture
- Parameters:
magFilter
- the magnification filter, one of: FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR, LINEAR_DETAIL, LINEAR_DETAIL_RGB, LINEAR_DETAIL_ALPHA, LINEAR_SHARPEN, LINEAR_SHARPEN_RGB, LINEAR_SHARPEN_ALPHA, or FILTER4.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.IllegalArgumentException
- ifminFilter
is a value other thanFASTEST
,NICEST
,BASE_LEVEL_POINT
,BASE_LEVEL_LINEAR
,LINEAR_DETAIL
,LINEAR_DETAIL_RGB
,LINEAR_DETAIL_ALPHA
,LINEAR_SHARPEN
,LINEAR_SHARPEN_RGB
,LINEAR_SHARPEN_ALPHA
, orFILTER4
.- Since:
- Java 3D 1.3
- See Also:
-
setDetailImage
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
detailTexture
- ImageComponent2D object containing the detail texture image.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getDetailImage
Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Returns:
- ImageComponent2D object containing the detail texture image.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setDetailTextureMode
public void setDetailTextureMode(int mode) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
mode
- detail texture mode. One of: DETAIL_ADD or DETAIL_MODULATE- Throws:
IllegalArgumentException
- ifmode
is a value other thanDETAIL_ADD
, orDETAIL_MODULATE
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getDetailTextureMode
public int getDetailTextureMode()Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Returns:
- the detail texture mode.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setDetailTextureLevel
public void setDetailTextureLevel(int level) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
level
- the detail texture level.- Throws:
IllegalArgumentException
- iflevel
< 0RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getDetailTextureLevel
public int getDetailTextureLevel()Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Returns:
- the detail texture level.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setDetailTextureFunc
public void setDetailTextureFunc(float[] lod, float[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
lod
- array containing the level-of-detail values.pts
- array containing the function values for the corresponding level-of-detail values.- Throws:
IllegalStateException
- if the length oflod
does not match the length ofpts
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
setDetailTextureFunc
public void setDetailTextureFunc(javax.vecmath.Point2f[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
pts
- array of Point2f containing the lod as well as the corresponding function value.- Throws:
RestrictedAccessException
- if the method is called when this object is part of live or compiled scene graph.- Since:
- Java 3D 1.3
- See Also:
-
getDetailTextureFuncPointsCount
public int getDetailTextureFuncPointsCount()Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Returns:
- the number of points in the detail texture LOD function.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getDetailTextureFunc
public void getDetailTextureFunc(float[] lod, float[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
lod
- the array to receive the level-of-detail values.pts
- the array to receive the function values for the corresponding level-of-detail values.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getDetailTextureFunc
public void getDetailTextureFunc(javax.vecmath.Point2f[] pts) Deprecated.As of Java 3D 1.5 the optional detail texture feature is no longer supported.- Parameters:
pts
- the array to receive the detail texture LOD function points- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
cloneNodeComponent
Deprecated.replaced with cloneNodeComponent(boolean forceDuplicate)- Overrides:
cloneNodeComponent
in classNodeComponent
-
duplicateNodeComponent
Deprecated.replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)NOTE: Applications should not call this method directly. It should only be called by the cloneNode method.- Overrides:
duplicateNodeComponent
in classNodeComponent
-