Texture

Texture for drawing using OpenGL.

Constructors

this
this()

Only allocates memory for the instance but does not create anything.

this
this(string file, TextureFilterMode min, TextureFilterMode mag, TextureClampMode wrapX, TextureClampMode wrapY)

Creates and loads the texture with the given filters.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

applyParameters
void applyParameters()

Use this when changing filter or wrap after creating the texture. Calls automatically after create.

bind
void bind(uint unit)

Binds the current texture to the given unit.

create
void create(uint width, uint height, void[] pixels)

Creates a width x height texture containing the pixel data in RGBA ubyte format.

create
void create(uint width, uint height, int mode, void[] pixels)

Creates a width x height texture containing the pixel data using ubytes.

create
void create(uint width, uint height, int inMode, int mode, void[] pixels, int type)

Creates a width x height texture containing the pixel data in inMode format using type as array type and internally convertes to mode.

dispose
void dispose()

Deletes the texture and invalidates this.

fromBitmap
void fromBitmap(Bitmap bitmap, string name)

Creates the texture from a bitmap.

resize
void resize(uint width, uint height, void[] pixels)

Resizes the texture containing the new data.

Properties

height
uint height [@property getter]

Height of this texture. height == 0 when not created.

id
uint id [@property getter]

OpenGL id of this texture. id == 0 when not created.

valid
bool valid [@property getter]

Checks if Texture.id is more than 0.

white
Texture white [@property getter]

1x1 texture containing a white pixel for solid shapes.

width
uint width [@property getter]

Width of this texture. width == 0 when not created.

Static functions

load
void load()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

enableMipMaps
bool enableMipMaps;

Enable mipmaps. Disabled by default.

magFilter
TextureFilterMode magFilter;

Mag Filter for this texture. Needs to call Texture.applyParameters when called after creation.

minFilter
TextureFilterMode minFilter;

Min Filter for this texture. Needs to call Texture.applyParameters when called after creation.

wrapX
TextureClampMode wrapX;

Wrap x for this texture. Needs to call Texture.applyParameters when called after creation.

wrapY
TextureClampMode wrapY;

Wrap y Filter for this texture. Needs to call Texture.applyParameters when called after creation.

Inherited Members

From IDisposable

dispose
void dispose()

Function for deallocating memory. Should be called in destructor.

From IVerifiable

valid
bool valid [@property getter]

Function for checking if this is valid.

Meta