Package org.xjge.graphics
Class Texture
java.lang.Object
org.xjge.graphics.Texture
public final class Texture
extends java.lang.Object
Supplies the data parsed from an image file into a new two-dimensional 
 texture object that can be used by the graphics pipeline. RBGA encoded .png 
 is the preferred file format of this engine. OpenGL texture parameters are 
 expected to be defined outside of this class following the texture objects 
 initialization.
- Since:
- 2.0.0
- 
Field SummaryFields Modifier and Type Field Description inthandle
- 
Constructor Summary
- 
Method SummaryModifier and Type Method Description voidfreeTexture()Frees the OpenGL texture image associated with this object.intgetChannels()Obtains the amount of color channels this texture uses.intgetHeight()Obtains the height of the texture.intgetWidth()Obtains the width of the texture.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Field Details- 
handlepublic final int handle
 
- 
- 
Constructor Details- 
Texturepublic Texture(java.lang.String filename, int target)Creates a new texture object from the image file specified. If the image file cannot be found, the engine will instead use a fallback texture in its place.- Parameters:
- filename- the name of the file to load. Expects the file extension to be included.
- target- the OpenGL texture target. One of:- TEXTURE_2D- TEXTURE_1D_ARRAY- TEXTURE_RECTANGLE- TEXTURE_CUBE_MAP- PROXY_TEXTURE_2D- PROXY_TEXTURE_1D_ARRAY- PROXY_TEXTURE_RECTANGLE- PROXY_TEXTURE_CUBE_MAP
 
- 
Texturepublic Texture(java.lang.String filename)Creates a new texture object from the image file specified. If the image file cannot be found, the engine will instead use a fallback texture in its place.- Parameters:
- filename- the name of the file to load. Expects the file extension to be included.
 
 
- 
- 
Method Details- 
getWidthpublic int getWidth()Obtains the width of the texture.- Returns:
- the textures width in pixels
 
- 
getHeightpublic int getHeight()Obtains the height of the texture.- Returns:
- the textures height in pixels
 
- 
getChannelspublic int getChannels()Obtains the amount of color channels this texture uses.- Returns:
- the number of color components the texture image exhibits
 
- 
freeTexturepublic void freeTexture()Frees the OpenGL texture image associated with this object. Should be used when a texture is no longer needed.- See Also:
- GL11.glDeleteTextures(int)
 
 
-