Class Texture
java.lang.Object
dev.prozilla.pine.common.system.resource.image.Texture
- All Implemented Interfaces:
Lifecycle
,Printable
,TextureBase
,Resource
Represents an OpenGL texture.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Binds this texture.void
destroy()
Removes this texture from the resource pool and deletes it.boolean
equals
(TextureBase other) boolean
getArray()
int
int
getId()
getPath()
int
getWidth()
boolean
hasEqualLocation
(TextureBase other) Checks whether two textures are from the same location.int
hashCode()
boolean
void
setParameter
(int name, int value) toString()
Returns a string representation of this object.void
unbind()
Unbinds this texture.void
uploadData
(int internalFormat, int width, int height, int format, ByteBuffer pixels) Uploads image data with specified internal format, width, height and image format.void
uploadData
(int width, int height, ByteBuffer pixels) Uploads image data with specified width and height.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
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:TextureBase
Binds this texture.- Specified by:
bind
in interfaceTextureBase
-
unbind
public void unbind()Description copied from interface:TextureBase
Unbinds this texture.- Specified by:
unbind
in 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:TextureBase
Removes this texture from the resource pool and deletes it. -
getId
public int getId()- Specified by:
getId
in interfaceTextureBase
-
getWidth
public int getWidth()- Specified by:
getWidth
in interfaceTextureBase
- Returns:
- The width of this texture, in pixels.
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceTextureBase
- Returns:
- The height of this texture, in pixels.
-
getPath
- Specified by:
getPath
in interfaceResource
- Specified by:
getPath
in interfaceTextureBase
- Returns:
- The path of the image file of this texture.
-
hasEqualLocation
Description copied from interface:TextureBase
Checks whether two textures are from the same location.- Specified by:
hasEqualLocation
in interfaceTextureBase
- Parameters:
other
- Other texture- Returns:
- True if
other
is equal to this texture or in the same texture array.
-
isInArray
public boolean isInArray()- Specified by:
isInArray
in interfaceTextureBase
- Returns:
- True if this texture is part of a texture array.
-
getArray
- Specified by:
getArray
in interfaceTextureBase
- Returns:
- The texture array this texture is part of, or
null
if this texture is not in a texture array.
-
hashCode
public int hashCode() -
equals
-
equals
-
toString
Description copied from interface:Printable
Returns a string representation of this object.
-