maspack.render
Class Texture

java.lang.Object
  extended by maspack.render.Texture

public class Texture
extends java.lang.Object

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.

Author:
Kevin Glass

Constructor Summary
Texture(int target, int textureID)
          Create a new texture
 
Method Summary
 void bind(javax.media.opengl.GL2 gl)
          Bind the specified GL context to a texture
 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
 float getWidth()
          Get the width of the physical texture
 void setHeight(int height)
          Set the height of the image
 void setTextureHeight(int texHeight)
          Set the height of this texture
 void setTextureWidth(int texWidth)
          Set the width of this texture
 void setWidth(int width)
          Set the width of the image
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Texture

public Texture(int target,
               int textureID)
Create a new texture

Parameters:
target - The GL target
textureID - The GL texture ID
Method Detail

bind

public void bind(javax.media.opengl.GL2 gl)
Bind the specified GL context to a texture

Parameters:
gl - The GL context to bind to

setHeight

public void setHeight(int height)
Set the height of the image

Parameters:
height - The height of the image

setWidth

public void setWidth(int width)
Set the width of the image

Parameters:
width - The width of the image

getImageHeight

public int getImageHeight()
Get the height of the original image

Returns:
The height of the original image

getImageWidth

public int getImageWidth()
Get the width of the original image

Returns:
The width of the original image

getHeight

public float getHeight()
Get the height of the physical texture

Returns:
The height of physical texture

getWidth

public float getWidth()
Get the width of the physical texture

Returns:
The width of physical texture

setTextureHeight

public void setTextureHeight(int texHeight)
Set the height of this texture

Parameters:
texHeight - The height of the texture

setTextureWidth

public void setTextureWidth(int texWidth)
Set the width of this texture

Parameters:
texWidth - The width of the texture