The OpenD Programming Language

OpenGlTexture

Simple class for putting a TrueColorImage in as an OpenGL texture.

Constructors

this
this(TrueColorImage from)

Make a texture from an image.

this
this(FONT* font, int size, T[] text)

Generates from text. Requires ttf.d pass a pointer to the TtfFont as the first arg (it is template cuz of lazy importing, not because it actually works with different types)

this
this()

Creates an empty texture class for you to use with bindFrom later Using it when not bound is undefined behavior.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

bind
void bind()

Calls glBindTexture

bindFrom
void bindFrom(TrueColorImage from)
void bindFrom(FONT* font, int size, T[] text)

After you delete it with dispose, you may rebind it to something else with this.

dispose
void dispose()

Deletes the texture. Using it after calling this is undefined behavior

draw
void draw(Point where, int width, int height, float rotation, Color bg)

For easy 2d drawing of it

draw
void draw(float x, float y, int width, int height, float rotation, Color bg)
originalImageWidth
int originalImageWidth()

Returns the size of the image

tex
uint tex()

Returns the texture ID

texCoordWidth
float texCoordWidth()

Use for glTexCoord2f

Meta