Class Texture
java.lang.Object
dev.prozilla.pine.common.system.resource.Texture
Represents an OpenGL texture.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind()
Binds the texture.static Texture
createTexture
(int width, int height, ByteBuffer data) Creates a texture with specified width, height and data.static Texture
createTexture
(Image image) Creates a texture based on an image.void
destroy()
Delete the texture.int
Gets the texture height.int
getWidth()
Gets the texture width.static void
reset()
void
setHeight
(int height) Sets the texture height.void
setParameter
(int name, int value) Sets a parameter of the texture.void
setWidth
(int width) Sets the texture width.toString()
Returns a string representation of this object.void
unbind()
void
uploadData
(int internalFormat, int width, int height, int format, ByteBuffer data) Uploads image data with specified internal format, width, height and image format.void
uploadData
(int width, int height, ByteBuffer data) Uploads image data with specified width and height.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
id
public final int idStores the handle of the texture. -
currentTextureId
-
-
Constructor Details
-
Texture
public Texture()Creates a texture.
-
-
Method Details
-
bind
public void bind()Binds the texture. -
unbind
public void unbind() -
setParameter
public void setParameter(int name, int value) Sets a parameter of the texture.- Parameters:
name
- Name of the parametervalue
- Value to set
-
uploadData
Uploads image data with specified width and height.- Parameters:
width
- Width of the imageheight
- Height of the imagedata
- 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 datadata
- Pixel data of the image
-
destroy
public void destroy()Delete the texture. -
getWidth
public int getWidth()Gets the texture width.- Returns:
- Texture width
-
setWidth
public void setWidth(int width) Sets the texture width.- Parameters:
width
- The width to set
-
getHeight
public int getHeight()Gets the texture height.- Returns:
- Texture height
-
setHeight
public void setHeight(int height) Sets the texture height.- Parameters:
height
- The height to set
-
toString
Description copied from interface:Printable
Returns a string representation of this object. -
createTexture
Creates a texture based on an image.- Parameters:
image
- Image- Returns:
- Texture
-
createTexture
Creates a texture with specified width, height and data.- Parameters:
width
- Width of the textureheight
- Height of the texturedata
- Picture Data in RGBA format- Returns:
- Texture from the specified data
-
reset
public static void reset()
-