Texture

A Texture is a 2 dimensional pixel reprasentation. It is a wrapper of an OpenGL Texture.

Constructors

this
this()

CTor

this
this(Texture tex, Format t_fmt)

Postblit

Destructor

~this
~this()

DTor

Members

Enums

Compression
enum Compression

Compression modes

Format
enum Format

Supported Texture Format

Functions

bind
void bind()

Binds this Texture. Means this Texture is now activated.

copy
void copy(Texture tex, ShortRect* rect)

Copy another Texture to this. The second parameter is a pointer to the destination rect. Is it is null this means the whole tex is copied.

free
void free()

Free / Delete the Texture & Memory After this call, the Pixel data is invalid.

getCompression
Compression getCompression()

Returns the current Compression mode.

getFormat
Format getFormat()

Returns the Format.

getMemory
void[] getMemory(void[] memory)

Returns the pixel of this Texture or null if this Texture isn't valid. If memory is not null and has the same width and height as the Texture, it is used to store the pixel data. Otherwise it <b>allocates</b> GC memory.

isCompressed
bool isCompressed()

Checks whether the current Texture is compressed or not.

isCurrentlyBound
bool isCurrentlyBound()

Returns true, if this Texture is currently activated.

isRepeated
bool isRepeated()

Returns if repeating is enabled.

isSmooth
bool isSmooth()

Returns if smooth filter are activated.

isValid
bool isValid()

Returns if the texture is used.

loadFromMemory
void loadFromMemory(void* memory, ushort width, ushort height, ubyte depth, Format fmt)

Load from memory.

setColorkey
void setColorkey(Color colorkey)

Set a colorkey.

setColorkey
void setColorkey(Color colorkey)

Rvalue version

setCompression
void setCompression(Compression comp)

(Re)Set the compression mode.

setRepeat
void setRepeat(bool repeat)

Set repeating for the (next) load.

setSmooth
void setSmooth(bool enable)

Set smooth filter for the (next) load.

subTexture
Texture subTexture(ShortRect rect)

Rvalue version

subTexture
Texture subTexture(ShortRect rect)

Returns a subTexture of this Texture.

unbind
void unbind()

Binds this Texture. Means this Texture is now deactivated.

update
void update(void* memory, ShortRect* rect, Format fmt)

Update the pixel data of this Texture. The second parameter is a pointer to the area which is updated. If it is null (default) the whole Texture will be updated. The third parameter is the format of the pixels.

Properties

Id
GLuint Id [@property getter]

Returns the Texture Id.

depth
ubyte depth [@property getter]

Returns the depth. May often 24 or 32.

height
ushort height [@property getter]

Returns the height of this Texture.

width
ushort width [@property getter]

Returns the width of this Texture

Static functions

currentlyBound
GLint currentlyBound()

Returns the currently bound texture id.

Meta

Authors

rschuett