|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.opengl.TextureImpl
public class TextureImpl
A texture to be bound within JOGL. This object is responsible for keeping track of a given OpenGL texture and for calculating the texturing mapping coordinates of the full image. Since textures need to be powers of 2 the actual texture may be considerably bigged that the source image and hence the texture mapping coordinates need to be adjusted to matchup drawing the sprite against the texture.
Field Summary | |
---|---|
protected static SGL |
GL
The renderer to use for all GL operations |
Constructor Summary | |
---|---|
protected |
TextureImpl()
For subclasses to utilise |
|
TextureImpl(java.lang.String ref,
int target,
int textureID)
Create a new texture |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static SGL GL
Constructor Detail |
---|
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 IDMethod Detail |
---|
public static Texture getLastBind()
public void setCacheName(java.lang.String cacheName)
cacheName
- The name the texture is stored against in the cachepublic boolean hasAlpha()
Texture
hasAlpha
in interface Texture
Texture.hasAlpha()
public java.lang.String getTextureRef()
Texture
getTextureRef
in interface Texture
Texture.getTextureRef()
public void setAlpha(boolean alpha)
alpha
- True, If this texture has alphapublic static void bindNone()
public static void unbind()
public void bind()
Texture
bind
in interface Texture
Texture.bind()
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
Texture.getImageHeight()
public int getImageWidth()
Texture
getImageWidth
in interface Texture
Texture.getImageWidth()
public float getHeight()
Texture
getHeight
in interface Texture
Texture.getHeight()
public float getWidth()
Texture
getWidth
in interface Texture
Texture.getWidth()
public int getTextureHeight()
Texture
getTextureHeight
in interface Texture
Texture.getTextureHeight()
public int getTextureWidth()
Texture
getTextureWidth
in interface Texture
Texture.getTextureWidth()
public void setTextureHeight(int texHeight)
texHeight
- The height of the texturepublic void setTextureWidth(int texWidth)
texWidth
- The width of the texturepublic void release()
Texture
release
in interface Texture
Texture.release()
public int getTextureID()
Texture
getTextureID
in interface Texture
Texture.getTextureID()
public void setTextureID(int textureID)
textureID
- The OpenGL texture IDprotected java.nio.IntBuffer createIntBuffer(int size)
size
- how many int to contain
public byte[] getTextureData()
Texture
getTextureData
in interface Texture
Texture.getTextureData()
public void setTextureFilter(int textureFilter)
Texture
setTextureFilter
in interface Texture
textureFilter
- The texture filter to apply (GL_LINEAR, GL_NEAREST, etc..)Texture.setTextureFilter(int)
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |