Texture
in package
Table of Contents
Properties
- $id : int
- The GL texture id / handle
- $name : string
- $target : int
- The texture target
- $options : TextureOptions|null
- The texture options object
- $gl : GLState
- $height : int
- The textures height (copied from the options)
- $width : int
- The textures width (copied from the options)
Methods
- __construct() : void
- Constructor
- __destruct() : mixed
- Destructor
- allocateEmpty() : void
- Allocates an empty texture with the given size and options
- bind() : void
- Binds the texture to the current context and sets the active texture unit
- height() : int
- Returns the textures height
- loadFromFile() : void
- Loads an image from disk into the texture
- size() : Vec2
- Returns the textures width and height as a floating point vector
- uploadBuffer() : void
- Uploads a buffer of raw data, expectes the internal properties to be set correctly.
- width() : int
- Returns the textures width
- applyFilterParameters() : void
- Applies the textures minification and magnification filter parameters
- applyWrapParameters() : void
- Applies the textures wrap parameters
Properties
$id read-only
The GL texture id / handle
public
int
$id
$name
public
string
$name
$target read-only
The texture target
public
int
$target
$options
The texture options object
protected
TextureOptions|null
$options
= null
$gl
private
GLState
$gl
$height
The textures height (copied from the options)
private
int
$height
= 0
$width
The textures width (copied from the options)
private
int
$width
= 0
Methods
__construct()
Constructor
public
__construct(GLState $gl, string $name[, int $target = GL_TEXTURE_2D ]) : void
Parameters
- $gl : GLState
- $name : string
-
A unique name for the texture, used for debugging and resource management
- $target : int = GL_TEXTURE_2D
__destruct()
Destructor
public
__destruct() : mixed
allocateEmpty()
Allocates an empty texture with the given size and options
public
allocateEmpty(int $width, int $height[, TextureOptions|null $options = null ]) : void
Parameters
- $width : int
- $height : int
- $options : TextureOptions|null = null
-
Optional texture options
bind()
Binds the texture to the current context and sets the active texture unit
public
bind([int $unit = GL_TEXTURE0 ]) : void
Parameters
- $unit : int = GL_TEXTURE0
-
The texture unit to bind the texture to
height()
Returns the textures height
public
height() : int
Return values
intloadFromFile()
Loads an image from disk into the texture
public
loadFromFile(string $path[, TextureOptions|null $options = null ]) : void
Parameters
- $path : string
-
Full absolute path to the image file
- $options : TextureOptions|null = null
-
Optional texture options
Tags
size()
Returns the textures width and height as a floating point vector
public
size() : Vec2
Return values
Vec2uploadBuffer()
Uploads a buffer of raw data, expectes the internal properties to be set correctly.
public
uploadBuffer(TextureOptions $options[, BufferInterface|null $buffer = null ]) : void
Parameters
- $options : TextureOptions
- $buffer : BufferInterface|null = null
width()
Returns the textures width
public
width() : int
Return values
intapplyFilterParameters()
Applies the textures minification and magnification filter parameters
private
applyFilterParameters() : void
applyWrapParameters()
Applies the textures wrap parameters
private
applyWrapParameters() : void