Texture2D

Represents an OpenGL 2D texture. The constructor must be used to avoid segmentation faults.

Constructors

this
this(GLenum unit)

Generates the OpenGL texture and initializes the struct.

Alias This

texture

Alias this to texture.

Members

Functions

get_unit
GLuint get_unit()
Undocumented in source. Be warned that the author may not have intended to support it.
set_data
void set_data(T data, GLint internal_format, GLsizei width, GLsizei height, GLenum format, GLenum type, bool mipmaps, GLint level)

Sets the texture data.

Mixins

__anonymous
mixin CommonTextureMethods
Undocumented in source.

Static functions

from_image
Texture2D from_image(string filename)

Loads an image and afterwards loads it into a Texture2D struct. Image can be loaded by stb and SDLImage. To select specific way use versions stb, SDLImage2 (SDL2) or SDLImage (SDL1).

from_image
Texture2D from_image(string filename)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

target
GLenum target;
Undocumented in source.

Variables

format
GLenum format;

Holds the format of the pixel data.

height
GLsizei height;

Holds the texture height.

internal_format
GLint internal_format;

Holds the internal format passed to the constructor.

mipmaps
bool mipmaps;

If true (default) mipmaps will be generated with glGenerateMipmap.

texture
GLuint texture;

The OpenGL texture name.

type
GLenum type;

Holds the OpenGL data type of the pixel data.

unit
GLenum unit;

Holds the texture unit.

width
GLsizei width;

Holds the texture width.

Mixed In Members

From mixin CommonTextureMethods

~this
~this()
Undocumented in source.
remove
void remove()

Deletes the texture.

set_parameter
void set_parameter(GLuint name, T params)

Sets a texture parameter.

get_parameter
float[] get_parameter(GLuint name)

Queries a texture parameter from OpenGL.

generate_mipmaps
void generate_mipmaps()

Generates mipmaps for the textre (also binds it)

bind
void bind()

Binds the texture.

activate
void activate(GLuint unit)

Activates the texture to unit, passed to the function.

activate
void activate()

Activates the texture to unit, the struct member.

bind_and_activate
void bind_and_activate(GLuint unit)

Binds the texture and activates it to unit, passed to the function.

bind_and_activate
void bind_and_activate()

Binds the texture and activates it to unit, the struct member.

unbind
void unbind()

Unbinds the texture.

Inherited Members

From ITexture

get_unit
GLuint get_unit()
Undocumented in source.
remove
void remove()
Undocumented in source.
set_parameter
void set_parameter(GLuint name, T params)
Undocumented in source.
get_parameter
float[] get_parameter(GLuint name)
Undocumented in source.
set_data
void set_data(T data)
Undocumented in source.
generate_mipmaps
void generate_mipmaps()
Undocumented in source.
bind
void bind()
Undocumented in source.
activate
void activate(GLuint unit)
Undocumented in source.
activate
void activate()
Undocumented in source.
bind_and_activate
void bind_and_activate(GLuint unit)
Undocumented in source.
bind_and_activate
void bind_and_activate()
Undocumented in source.
unbind
void unbind()
Undocumented in source.

Meta