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.Linear, TextureFilterMode mag = TextureFilterMode.Linear, TextureClampMode wrapX = TextureClampMode.Repeat, TextureClampMode wrapY = TextureClampMode.Repeat)

Creates and loads the texture with the given filters.

Destructor

A destructor is present on this object, but not explicitly documented in the 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 = GL_UNSIGNED_BYTE)

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 = "Bitmap")

Creates the texture from a bitmap.

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

Recreates a width x height texture containing the pixel data in RGBA ubyte format without disposing the old one.

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

Recreates a width x height texture containing the pixel data using ubytes without disposing the old one.

recreate
void recreate(uint width, uint height, int inMode, int mode, void[] pixels, int type = GL_UNSIGNED_BYTE)

Recreates a width x height texture containing the pixel data in inMode format using type as array type and internally convertes to mode without disposing the old one.

recreateFromBitmap
void recreateFromBitmap(Bitmap bitmap, string name = "Bitmap")

Creates the texture from a bitmap without disposing the old one.

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

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.

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.

Meta