com.neovisionaries.android.opengl
Class Texture2D

java.lang.Object
  extended by com.neovisionaries.android.opengl.Texture<Texture2D>
      extended by com.neovisionaries.android.opengl.Texture2D

public class Texture2D
extends Texture<Texture2D>

OpenGL ES 2D texture.

Author:
Takahiko Kawasaki

Constructor Summary
Texture2D()
          A constructor to create a 2D texture (GL_TEXTURE_2D).
 
Method Summary
 boolean isBound()
          Check if this 2D texture is bound.
 Texture2D loadImage(Bitmap bitmap)
          This method is an alias of loadImage(bitmap, 0).
 Texture2D loadImage(Bitmap bitmap, int level)
          Load an image.
 
Methods inherited from class com.neovisionaries.android.opengl.Texture
bind, delete, generateMipmap, getId, getState, getType, getUnit, setMagFilter, setMinFilter, setUnit, setWrapS, setWrapT
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Texture2D

public Texture2D()
          throws GLESException
A constructor to create a 2D texture (GL_TEXTURE_2D). super(TextureType.TWO_D) is called. After this constructor returns, the state of this instance is CREATED.

Throws:
GLESException - glGenTextures() failed.
See Also:
Texture.Texture(TextureType), glGenTextures
Method Detail

isBound

public boolean isBound()
Check if this 2D texture is bound.

This method returns true (1) if the current active texture unit is the same as the one that this texture should be bound to and (2) if the value returned from GLESState.getTextureBinding2D() and the value returned from Texture.getId() are identical.

Specified by:
isBound in class Texture<Texture2D>
Returns:
True if this 2D texture is bound.
See Also:
GLESState.getActiveTexture(), GLESState.getTextureBinding2D()

loadImage

public Texture2D loadImage(Bitmap bitmap,
                           int level)
Load an image.

If this texture is not bound when this method is called, bind() is called first. Then, GLUtils.texImage2D(GL_TEXTURE_2D, level, bitmap, 0) is called.

Parameters:
bitmap - Image to load.
level - Mipmap level.
Returns:
This Texture object.
Throws:
IllegalArgumentException - 'bitmap' is null or 'level' is less than 0.
IllegalStateException - This texture has already been deleted.
See Also:
GLUtils.texImage2D, glTexImage2D

loadImage

public Texture2D loadImage(Bitmap bitmap)
This method is an alias of loadImage(bitmap, 0).