Texture

openGLのtextureを表すクラスです. 初期化後,allocateして利用します.

Constructors

this
this()

Destructor

~this
~this()
Undocumented in source.

Members

Functions

allocate
Texture allocate(int w, int h)

Allocate texture

allocate
Texture allocate(int w, int h, ColorFormat format)

Allocate texture

allocate
Texture allocate(Bitmap!(char) bitmap)

Allocate texture

allocate
Texture allocate(ubyte[] bits, int w, int h, ColorFormat format)

Allocate texture

allocate
Texture allocate(ColorFormat format)

Allocate texture

allocate
Texture allocate()

Allocate texture

begin
Texture begin()

Begin to bind the texture.

bind
Texture bind()
end
Texture end()

End to bind the texture.

height
int height()
id
int id()

Return gl texture id.

magFilter
Texture magFilter(TextureMagFilter filter)
minFilter
Texture minFilter(TextureMinFilter filter)
minMagFilter
Texture minMagFilter(TextureMinFilter minFilter, TextureMagFilter magFilter)
pixel
ubyte pixel()

Return pixel of texture

pixel
Texture pixel(ubyte v)

Set pixel of texture

resize
Texture resize(Vector2i textureSize)

Resize texture.

size
Vector2i size()

Return the texture size.

width
int width()
wrap
Texture wrap(TextureWrap p)
wrapS
Texture wrapS(TextureWrap p)
wrapT
Texture wrapT(TextureWrap p)

Examples

auto texture = new Texture;
texture.allocate(256, 256);

auto rect = new Mesh;
rect.primitiveMode = PrimitiveMode.Quads;
texture.begin;
    rect.addTexCoord(0, 1);rect.addVertex(0, 0, 0);
    rect.addTexCoord(0, 0);rect.addVertex(0, 1, 0);
    rect.addTexCoord(1, 0);rect.addVertex(1, 1, 0);
    rect.addTexCoord(1, 1);rect.addVertex(1, 0, 0);
texture.end;

rect.addIndex(0);
rect.addIndex(1);
rect.addIndex(2);
rect.addIndex(3);

texture.begin;
    rect.drawFill();
texture.end;

Meta