glamour



class  TextureException: object.Exception;

This exception will be thrown if Texture2D.from_image fails to open the image.


Every Texture-Class will mixin this template.


void  remove();

Deletes the texture.


void  set_parameter(T)(GLuint name, T params);

Sets a texture parameter.


float[]  get_parameter(GLuint name);

Queries a texture parameter from OpenGL.


void  generate_mipmaps();

Generates mipmaps for the textre (also binds it)


void  bind();

Binds the texture.


void  activate(GLuint unit);

Activates the texture to unit, passed to the function.


void  activate();

Activates the texture to unit, the struct member.


void  bind_and_activate(GLuint unit);

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


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


void  unbind();

Unbinds the texture.


abstract interface  ITexture;

Interface every Texture implements.


abstract GLuint  get_unit();




abstract void  remove();




void  set_parameter(T)(GLuint name, T params);




abstract float[]  get_parameter(GLuint name);




void  set_data(T)(T data);




abstract void  generate_mipmaps();




abstract void  bind();




abstract void  activate(GLuint unit);




abstract void  activate();




abstract void  bind_and_activate(GLuint unit);




abstract void  bind_and_activate();




abstract void  unbind();




class  Texture1D: glamour.texture.ITexture;

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


GLuint  texture;

The OpenGL  texture name.


GLint  internal_format;

Holds the internal format passed to the constructor.


GLenum  format;

Holds the  format of the pixel data.


GLenum  type;

Holds the OpenGL data  type of the pixel data.


GLuint  unit;

Holds the texture  unit.


this(GLenum unit = GL_TEXTURE0);

Generates the OpenGL texture and initializes the struct.

Parameters
unit_ Specifies the OpenGL texture uinit.

void  set_data(T)(T data, GLint internal_format, int width, GLenum format, GLenum type);

Sets the texture data.

Parameters
data A pointer to the image data or an array of the image data.
internal_format Specifies the number of color components in the texture.
width If data is an array and width is -1, the width will be infered from the array, otherwise it must be valid.
format Specifies the format of the pixel data.
type Specifies the data type of the pixel data.
See Also
OpenGL, http://www.opengl.org/sdk/docs/man4/xhtml/glTexImage1D.xml

class  Texture2D: glamour.texture.ITexture;

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


GLuint  texture;

The OpenGL  texture name.


GLint  internal_format;

Holds the internal format passed to the constructor.


GLsizei  width;

Holds the texture  width.


GLsizei  height;

Holds the texture  height.


GLenum  format;

Holds the  format of the pixel data.


GLenum  type;

Holds the OpenGL data  type of the pixel data.


GLenum  unit;

Holds the texture  unit.


bool  mipmaps;

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


this(GLenum unit = GL_TEXTURE0);

Generates the OpenGL texture and initializes the struct.

Parameters
GLenum unit Specifies the OpenGL texture uinit.

void  set_data(T)(T data, GLint internal_format, GLsizei width, GLsizei height, GLenum format, GLenum type, bool mipmaps = true, GLint level = 0);

Sets the texture data.

Parameters
data A pointer to the image data or an array of the image data.
internal_format Specifies the number of color components in the texture.
width Specifies the width of the texture image.
height Specifies the height of the texture image.
format Specifies the format of the pixel data.
type Specifies the data type of the pixel data.
mipmaps Enables mipmap-generation.
level Specifies the level-of-detail number. Level 0 is the base image level. Level n is the n th mipmap reduction image.
See Also
OpenGL, http://www.opengl.org/sdk/docs/man4/xhtml/glTexImage2D.xml

If mipmaps is true, the gl extensions must be loaded, otherwise bad things will happen!

static Texture2D  from_image(string filename);

Loads an image with DevIL and afterwards loads it into a Texture2D struct. DevIL must be loaded and initialized manually!


class  Texture3DBase(GLenum target_): ITexture;

Base class, which represents an OpenGL 3D or 2D array texture. The constructor must be used to avoid segmentation faults.


GLuint  texture;

The OpenGL  texture name.


GLint  internal_format;

Holds the internal format passed to the constructor.


GLenum  format;

Holds the  format of the pixel data.


GLenum  type;

Holds the OpenGL data  type of the pixel data.


GLuint  unit;

Holds the texture  unit.


this(GLenum unit = GL_TEXTURE0);

Generates the OpenGL texture and initializes the struct.

Parameters
GLenum unit Specifies the OpenGL texture uinit.

void  set_data(T)(T data, GLint internal_format, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level = 0);

Sets the texture data.

Parameters
data A pointer to the image data or an array of the image data.
internal_format Specifies the number of color components in the texture.
width Specifies the width of the texture image.
height Specifies the height of the texture image.
depth Specifies the depth of the texture image, or the number of layers in a texture array.
format Specifies the format of the pixel data.
type Specifies the data type of the pixel data.
See Also
http:
//www.opengl.org/sdk/docs/man4/xhtml/glTexImage3D.xml