public class TextureImpl extends java.lang.Object implements Texture
Modifier and Type | Field and Description |
---|---|
protected static SGL |
GL
The renderer to use for all GL operations
|
Modifier | Constructor and Description |
---|---|
protected |
TextureImpl()
For subclasses to utilise
|
|
TextureImpl(java.lang.String ref,
int target,
int textureID)
Create a new texture
|
Modifier and Type | Method and Description |
---|---|
void |
bind()
Bind the GL context to a texture
|
static void |
bindNone()
Clear the binding of the texture
|
protected java.nio.IntBuffer |
createIntBuffer(int size)
Creates an integer buffer to hold specified ints
- strictly a utility method
|
float |
getHeight()
Get the height of the physical texture
|
int |
getImageHeight()
Get the height of the original image
|
int |
getImageWidth()
Get the width of the original image
|
static Texture |
getLastBind()
Retrieve the last texture bound through the texture interface
|
byte[] |
getTextureData()
Get the pixel data from the card for this texture
|
int |
getTextureHeight()
Get the height of the actual texture
|
int |
getTextureID()
Get the OpenGL texture ID for this texture
|
java.lang.String |
getTextureRef()
Get the reference from which this texture was loaded
|
int |
getTextureWidth()
Get the width of the actual texture
|
float |
getWidth()
Get the width of the physical texture
|
boolean |
hasAlpha()
Check if the texture has alpha
|
void |
release()
Destroy the texture reference
|
void |
reload()
Reload this texture
|
void |
setAlpha(boolean alpha)
If this texture has alpha
|
void |
setCacheName(java.lang.String cacheName)
Set the name this texture is stored against in the cache
|
void |
setHeight(int height)
Set the height of the image
|
void |
setTextureData(int srcPixelFormat,
int componentCount,
int minFilter,
int magFilter,
java.nio.ByteBuffer textureBuffer)
Set the texture data that this texture can be reloaded from
|
void |
setTextureFilter(int textureFilter)
Apply a given texture filter to the texture
|
void |
setTextureHeight(int texHeight)
Set the height of this texture
|
void |
setTextureID(int textureID)
Set the OpenGL texture ID for this texture
|
void |
setTextureWidth(int texWidth)
Set the width of this texture
|
void |
setWidth(int width)
Set the width of the image
|
static void |
unbind()
Clear slick caching of the last bound texture so that an
external texture binder can play with the context before returning
control to slick.
|
protected static SGL GL
protected TextureImpl()
public TextureImpl(java.lang.String ref, int target, int textureID)
ref
- The reference this texture was loaded fromtarget
- The GL targettextureID
- The GL texture IDpublic static Texture getLastBind()
public void setCacheName(java.lang.String cacheName)
cacheName
- The name the texture is stored against in the cachepublic boolean hasAlpha()
Texture
public java.lang.String getTextureRef()
Texture
getTextureRef
in interface Texture
public void setAlpha(boolean alpha)
alpha
- True, If this texture has alphapublic static void bindNone()
public static void unbind()
public void bind()
Texture
public void setHeight(int height)
height
- The height of the imagepublic void setWidth(int width)
width
- The width of the imagepublic int getImageHeight()
Texture
getImageHeight
in interface Texture
public int getImageWidth()
Texture
getImageWidth
in interface Texture
public float getHeight()
Texture
public float getWidth()
Texture
public int getTextureHeight()
Texture
getTextureHeight
in interface Texture
public int getTextureWidth()
Texture
getTextureWidth
in interface Texture
public void setTextureHeight(int texHeight)
texHeight
- The height of the texturepublic void setTextureWidth(int texWidth)
texWidth
- The width of the texturepublic void release()
Texture
public int getTextureID()
Texture
getTextureID
in interface Texture
public void setTextureID(int textureID)
textureID
- The OpenGL texture IDprotected java.nio.IntBuffer createIntBuffer(int size)
size
- how many int to containpublic byte[] getTextureData()
Texture
getTextureData
in interface Texture
public void setTextureFilter(int textureFilter)
Texture
setTextureFilter
in interface Texture
textureFilter
- The texture filter to apply (GL_LINEAR, GL_NEAREST, etc..)public void setTextureData(int srcPixelFormat, int componentCount, int minFilter, int magFilter, java.nio.ByteBuffer textureBuffer)
srcPixelFormat
- The pixel formatcomponentCount
- The component countminFilter
- The OpenGL minification filtermagFilter
- The OpenGL magnification filtertextureBuffer
- The texture buffer containing the data for the texturepublic void reload()