|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.hermetica.util3d.Texture
Encapsulation of a chunk of texture information. This class provides the programmer with the ability to retrieve images, such as GIF and JPEG images, from arbitrary URLs and use them in OpenGL as texture maps. This class will handle the processing of the images into arrays of data that OpenGL uses for texture-map specification. The isValid() method should be invoked prior to using the texture to make sure it has completely downloaded, due to the asynchronous nature of Java's AWT.
In addition to this, all textures exist in the RGBA colourspace, thereby allowing you to easily build textures with transparency.
GL.glTexImage1D(int, int, int, int, int, int, int, byte[])
,
GL.glTexImage2D(int, int, int, int, int, int, int, int, byte[])
Field Summary | |
static int |
SCALE_DONT
Don't scale the texture at all. |
static int |
SCALE_MAGNIFY
Scale the texture up on both axes |
static int |
SCALE_MINIFY
Scale the texture down on both axes |
static int |
SCALE_NEAREST
Scale the texture to the nearest ^2 in each axis. |
Constructor Summary | |
Texture(java.awt.Image image,
GLDrawable component)
Default constructor with just the image we wish to create the texture from |
|
Texture(java.awt.Image image,
GLDrawable component,
int scaling)
Slightly more sophisticated constructor that allows us to specify what we wish to do with regards to scaling the texture. |
|
Texture(java.awt.image.ImageProducer producer,
GLDrawable component)
Default constructor with just the ImageProducer we wish to create the texture from |
|
Texture(java.awt.image.ImageProducer producer,
GLDrawable component,
int scaling)
Slightly more sophisticated constructor that allows us to specify what we wish to do with regards to scaling the texture. |
Method Summary | |
int |
getHeight()
Returns the height of the texture |
byte[] |
getTexture()
Returns the textureData array |
int |
getWidth()
Returns the width of the texture |
void |
imageComplete(int status)
Indicates the image is complete |
boolean |
isInitialized()
Handy object-orientated store that signifies whether or not you have used your texture yet. |
boolean |
isValid()
Returns whether or not this texture is valid, ie, whether all the data has been received and processed into suitable OpenGL data. |
static int |
nearestPower2(int value,
int scaleRule)
Calculates the nearest power of two to the given number |
void |
setColorModel(java.awt.image.ColorModel model)
Sets the colour model of this texture |
void |
setDimensions(int width,
int height)
Sets the dimensions of the texture |
void |
setHints(int hintflags)
Sets any hints on image production |
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
byte[] pixels,
int off,
int scansize)
Sets the pixels of the image in byte format |
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
int[] pixels,
int off,
int scansize)
Sets the pixels of the image in byte format |
void |
setProperties(java.util.Hashtable props)
Sets the properties of this ImageConsumer |
java.lang.String |
toAWTByteArray(java.lang.String variableName)
Returns a String containing a byte array declaration of this texture in a format suitable for use within AWT |
java.lang.String |
toAWTIntArray(java.lang.String variableName)
Returns a String containing an int[] declaration of this texture for use with AWT, ie, each 4 component pixel is packed into a 24-bit value ( ALPHA | RED | GREEN | BLUE ) |
java.lang.String |
toOpenGLIntArray(java.lang.String variableName)
Returns a String containing an int[] declaration of this texture for use with OpenGL's texture mapping routines. |
java.lang.String |
toString()
Returns a String representation of the texture |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int SCALE_DONT
public static final int SCALE_NEAREST
public static final int SCALE_MAGNIFY
public static final int SCALE_MINIFY
Constructor Detail |
public Texture(java.awt.Image image, GLDrawable component)
public Texture(java.awt.Image image, GLDrawable component, int scaling)
public Texture(java.awt.image.ImageProducer producer, GLDrawable component)
public Texture(java.awt.image.ImageProducer producer, GLDrawable component, int scaling)
Method Detail |
public int getWidth()
public int getHeight()
public boolean isValid()
public boolean isInitialized()
public byte[] getTexture()
public void imageComplete(int status)
public void setColorModel(java.awt.image.ColorModel model)
public void setDimensions(int width, int height)
public void setHints(int hintflags)
public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int off, int scansize)
public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int off, int scansize)
public void setProperties(java.util.Hashtable props)
public java.lang.String toString()
public java.lang.String toAWTByteArray(java.lang.String variableName)
public java.lang.String toAWTIntArray(java.lang.String variableName)
public java.lang.String toOpenGLIntArray(java.lang.String variableName)
public static int nearestPower2(int value, int scaleRule)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |