hmi.graphics.opengl
Class GLTexture

java.lang.Object
  extended by hmi.graphics.opengl.GLTexture
All Implemented Interfaces:
GLRenderObject

public class GLTexture
extends Object
implements GLRenderObject

A wrapper for OpenGL texture objects, in the form of an GLRenderObject.


Field Summary
private  float anisotropy
           
private  int format
           
private  int genMipMap
           
private  int glTextureUnit
           
private  boolean hasAlpha
           
private  int height
           
private  Buffer imageBuffer
           
private  String imageFile
           
private  int internalFormat
           
private  int magnificationFilter
           
static float max_anisotropy
           
private  int minificationFilter
           
(package private) static int NOBORDER
           
private  int textureId
           
private  int textureUnit
           
private  int type
           
private  int width
           
private  int wrap_S
           
private  int wrap_T
           
(package private) static int ZEROLEVEL
           
 
Constructor Summary
GLTexture()
          Default constructor
GLTexture(int width, int height, int format, int type, boolean hasAlpha, Buffer image, String imageFile)
          Creates a new GLTexture object with specified texture parameters The imageFile name is optional, but still useful for debugging purposes.
 
Method Summary
 int getFormat()
           
 int getHeight()
           
 int getId()
          Returns the OpenGL texture id.
 Buffer getImageBuffer()
           
 String getImageFileName()
          returns the image file name
 int getType()
           
 int getWidth()
           
 void glInit(GLRenderContext gl)
          The OpenGL initialization.
 void glRender(GLRenderContext gl)
          The OpenGL rendering.
 boolean hasAlpha()
           
 void setAnisotropy(float anisotropy)
          Sets the anisotropy valeu.
 void setFormat(int format)
           
 void setGenerateMipMap(boolean generateMipMap)
          Sets the mipmap generate mode.
 void setHeight(int height)
           
 void setImageBuffer(Buffer buf)
           
 void setImageFileName(String imageFile)
          Sets the (optional) image file name, for debugging purposes
 void setMagnificationFilter(int magnificationFilter)
          Sets the magnification filter.
 void setMinificationFilter(int minificationFilter)
          Sets the minification filter.
 void setTextureUnit(int tu)
          Sets the texture unit to be used for this texture.
 void setWidth(int width)
           
 void setWrap_S(int wrapMode)
          Sets the wrap mode for the S direction.
 void setWrap_T(int wrapMode)
          Sets the wrap mode for the T direction.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

textureId

private int textureId

textureUnit

private int textureUnit

glTextureUnit

private int glTextureUnit

minificationFilter

private int minificationFilter

magnificationFilter

private int magnificationFilter

anisotropy

private float anisotropy

wrap_S

private int wrap_S

wrap_T

private int wrap_T

genMipMap

private int genMipMap

width

private int width

height

private int height

format

private int format

type

private int type

hasAlpha

private boolean hasAlpha

imageBuffer

private Buffer imageBuffer

internalFormat

private int internalFormat

imageFile

private String imageFile

ZEROLEVEL

static final int ZEROLEVEL
See Also:
Constant Field Values

NOBORDER

static final int NOBORDER
See Also:
Constant Field Values

max_anisotropy

public static float max_anisotropy
Constructor Detail

GLTexture

public GLTexture()
Default constructor


GLTexture

public GLTexture(int width,
                 int height,
                 int format,
                 int type,
                 boolean hasAlpha,
                 Buffer image,
                 String imageFile)
Creates a new GLTexture object with specified texture parameters The imageFile name is optional, but still useful for debugging purposes.

Method Detail

setImageFileName

public void setImageFileName(String imageFile)
Sets the (optional) image file name, for debugging purposes


getImageFileName

public String getImageFileName()
returns the image file name


toString

public String toString()
Overrides:
toString in class Object

getWidth

public int getWidth()

getHeight

public int getHeight()

getFormat

public int getFormat()

getType

public int getType()

hasAlpha

public boolean hasAlpha()

getImageBuffer

public Buffer getImageBuffer()

setFormat

public void setFormat(int format)

setWidth

public void setWidth(int width)

setHeight

public void setHeight(int height)

setImageBuffer

public void setImageBuffer(Buffer buf)

setMinificationFilter

public void setMinificationFilter(int minificationFilter)
Sets the minification filter. The default value is GLC.GL_LINEAR_MIPMAP_LINEAR


setMagnificationFilter

public void setMagnificationFilter(int magnificationFilter)
Sets the magnification filter. The default value is GLC.GL_LINEAR


setAnisotropy

public void setAnisotropy(float anisotropy)
Sets the anisotropy valeu. The default value is 1.0 (no anisotropic correction)


setWrap_S

public void setWrap_S(int wrapMode)
Sets the wrap mode for the S direction. The deafult is GLC.GL_REPEAT;


setWrap_T

public void setWrap_T(int wrapMode)
Sets the wrap mode for the T direction. The deafult is GLC.GL_REPEAT;


setGenerateMipMap

public void setGenerateMipMap(boolean generateMipMap)
Sets the mipmap generate mode. The default is GLC.GL_TRUE


setTextureUnit

public void setTextureUnit(int tu)
Sets the texture unit to be used for this texture. The default value is 0


getId

public int getId()
Returns the OpenGL texture id.


glInit

public void glInit(GLRenderContext gl)
The OpenGL initialization. It generates a texture id, and passes on all current texture parameters to OGL.

Specified by:
glInit in interface GLRenderObject

glRender

public final void glRender(GLRenderContext gl)
The OpenGL rendering. sets the correct texture unit and binds the texture.

Specified by:
glRender in interface GLRenderObject