d2d.rendering.texture



enum TextureFilterMode: int;
Texture filter mode for min and mag filters.

Linear
GL_LINEAR
sampling. Smooth looking textures.

Nearest
GL_NEAREST
sampling. No smoothing.

NearestMipmapNearest
GL_NEAREST_MIPMAP_NEAREST
sampling. Not usable in mag filter.

LinearMipmapNearest
GL_LINEAR_MIPMAP_NEAREST
sampling. Not usable in mag filter.

NearestMipmapLinear
GL_NEAREST_MIPMAP_LINEAR
sampling. Not usable in mag filter.

LinearMipmapLinear
GL_LINEAR_MIPMAP_LINEAR
sampling. Not usable in mag filter.

enum TextureClampMode: int;
Texture clamp mode for wrap x, wrap y, wrap z.

ClampToBorder
Clamps the texture coordinate at the border. Will include a border.

ClampToEdge
Clamps the texture coordinate at the edge of the texture.

Repeat
Repeats the texture coordinate when being larger than 1.

Mirror
Repeats the texture coordinate and mirrors every time for better tiling.

class Texture: d2d.core.idisposable.IDisposable, d2d.core.iverifiable.IVerifiable;
Texture for drawing using OpenGL.

bool enableMipMaps;
Enable mipmaps. Disabled by default.

TextureFilterMode minFilter;
Min Filter for this texture.

Needs to call Texture.applyParameters when called after creation.

TextureFilterMode magFilter;
Mag Filter for this texture.

Needs to call Texture.applyParameters when called after creation.

TextureClampMode wrapX;
Wrap x for this texture.

Needs to call Texture.applyParameters when called after creation.

TextureClampMode wrapY;
Wrap y Filter for this texture.

Needs to call Texture.applyParameters when called after creation.

@property uint id();
OpenGL id of this texture.

id == 0 when not created.

@property uint width();
Width of this texture.

width == 0 when not created.

@property uint height();
Height of this texture.

height == 0 when not created.

static @property Texture white();
1x1 texture containing a white pixel for solid shapes.

this();
Only allocates memory for the instance but does not create anything.

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.

void create(uint width, uint height, void[] pixels);
Creates a width x height texture containing the pixel data in RGBA ubyte format.

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.

void create(uint width, uint height, int mode, void[] pixels);
Creates a width x height texture containing the pixel data using ubytes.

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.

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
.

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.

void applyParameters();
Use this when changing filter or wrap after creating the texture.

Calls automatically after
create
.

void bind(uint unit);
Binds the current texture to the given unit.

void fromBitmap(Bitmap bitmap, string name = "Bitmap");
Creates the texture from a bitmap.

void recreateFromBitmap(Bitmap bitmap, string name = "Bitmap");
Creates the texture from a bitmap without disposing the old one.

void resize(uint width, uint height, void[] pixels = null);
Resizes the texture containing the new data.

void dispose();
Deletes the texture and invalidates
this
.

@property bool valid();
Checks if Texture.id is more than 0.


Page generated by Ddoc.