Class Texture
java.lang.Object
dev.prozilla.pine.common.asset.image.Texture
- All Implemented Interfaces:
Asset,TextureBase,Cloneable<Texture>,Destructible,Printable
Represents an OpenGL texture.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Binds this texture.clone()Returns a new object that is equal to this object.voiddestroy()Removes this texture from the resource pool and deletes it.booleanChecks if the given object is equal to this object.booleanequals(TextureBase other) booleangetArray()intintgetId()getPath()Returns the path to the file this asset was loaded from.intgetWidth()booleanhasEqualLocation(TextureBase other) Checks whether two textures are from the same location.inthashCode()booleanvoidsetParameter(int name, int value) toString()Returns a string representation of this object.voidunbind()Unbinds this texture.voiduploadData(int internalFormat, int width, int height, int format, ByteBuffer pixels) Uploads image data with specified internal format, width, height and image format.voiduploadData(int width, int height, ByteBuffer pixels) Uploads image data with specified width and height.
-
Constructor Details
-
Texture
public Texture(int width, int height) Creates an empty texture. -
Texture
Creates a texture based on an image. -
Texture
-
-
Method Details
-
bind
public void bind()Description copied from interface:TextureBaseBinds this texture.- Specified by:
bindin interfaceTextureBase
-
unbind
public void unbind()Description copied from interface:TextureBaseUnbinds this texture.- Specified by:
unbindin interfaceTextureBase
-
setParameter
public void setParameter(int name, int value) -
uploadData
Uploads image data with specified width and height.- Parameters:
width- Width of the imageheight- Height of the imagepixels- Pixel data of the image
-
uploadData
Uploads image data with specified internal format, width, height and image format.- Parameters:
internalFormat- Internal format of the image datawidth- Width of the imageheight- Height of the imageformat- Format of the image datapixels- Pixel data of the image
-
destroy
public void destroy()Description copied from interface:TextureBaseRemoves this texture from the resource pool and deletes it.- Specified by:
destroyin interfaceAsset- Specified by:
destroyin interfaceDestructible- Specified by:
destroyin interfaceTextureBase
-
getId
public int getId()- Specified by:
getIdin interfaceTextureBase
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceTextureBase- Returns:
- The width of this texture, in pixels.
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceTextureBase- Returns:
- The height of this texture, in pixels.
-
getPath
Description copied from interface:AssetReturns the path to the file this asset was loaded from.- Specified by:
getPathin interfaceAsset- Specified by:
getPathin interfaceTextureBase- Returns:
- The path of the image file of this texture.
-
hasEqualLocation
Description copied from interface:TextureBaseChecks whether two textures are from the same location.- Specified by:
hasEqualLocationin interfaceTextureBase- Parameters:
other- Other texture- Returns:
- True if
otheris equal to this texture or in the same texture array.
-
isInArray
public boolean isInArray()- Specified by:
isInArrayin interfaceTextureBase- Returns:
- True if this texture is part of a texture array.
-
getArray
- Specified by:
getArrayin interfaceTextureBase- Returns:
- The texture array this texture is part of, or
nullif this texture is not in a texture array.
-
hashCode
public int hashCode() -
equals
Description copied from interface:CloneableChecks if the given object is equal to this object. -
equals
-
equals
-
clone
Description copied from interface:CloneableReturns a new object that is equal to this object. -
toString
Description copied from interface:PrintableReturns a string representation of this object.
-