gfm

This module defines one  texture type for each sort of OpenGL  texture.


class  GLTexture;

OpenGL Texture wrapper.

TODO:


  • Support partial updates.


  • Support glStorage through pseudo-code given in OpenGL specification.



this(OpenGL gl, GLuint target);

Creates a texture. You should create a child class instead of calling

this constructor directly.

Throws
OpenGLException on error.

final void  use(int textureUnit = 0);

Use this texture, binding it to a texture unit.

Parameters
int textureUnit Index of the texture unit to  use.

final void  unuse();

Unuse this texture.


final int  getParam(GLenum paramName);

Returns
Requested texture parameter.
Throws
OpenGLException on error.
Warning:
Calling glGetTexParameteriv is generally not recommended

since it could stall the OpenGL pipeline.

final int  getLevelParam(GLenum paramName, int level);

Returns
Requested texture level parameter.
Throws
OpenGLException on error.
Warning:
Calling glGetTexLevelParameteriv is generally not recommended

since it could stall the OpenGL pipeline.

final void  setBaseLevel(int level);

Sets the texture base level.

Throws
OpenGLException on error.

final void  setMaxLevel(int level);

Sets the texture maximum level.

Throws
OpenGLException on error.

final void  setMinLOD(float lod);

Sets the texture minimum LOD.

Throws
OpenGLException on error.

final void  setMaxLOD(float lod);

Sets the texture maximum LOD.

Throws
OpenGLException on error.

final void  setLODBias(float lodBias);

Sets the texture LOD bias.

Throws
OpenGLException on error.

final void  setWrapS(GLenum wrapS);

Sets the wrap mode for 1st texture coordinate.

Throws
OpenGLException on error.

final void  setWrapT(GLenum wrapT);

Sets the wrap mode for 2nd texture coordinate.

Throws
OpenGLException on error.

final void  setWrapR(GLenum wrapR);

Sets the wrap mode for 3rd texture coordinate.

Throws
OpenGLException on error.

final void  setMinFilter(GLenum minFilter);

Sets the texture minification filter mode.

Throws
OpenGLException on error.

final void  setMagFilter(GLenum magFilter);

Sets the texture magnification filter mode.

Throws
OpenGLException on error.

final void  setMaxAnisotropy(float f);

Sets the texture anisotropic filter level.

If texture anisotropy isn't supported, fail silently.

Throws
OpenGLException on error.

final void  getTexImage(int level, GLenum format, GLenum type, void* data);

Gets the texture data.

Throws
OpenGLException on error.

const pure nothrow GLuint  handle();

Returns
Wrapped OpenGL resource  handle.

void  generateMipmap();

Regenerates the mipmapped levels.

Throws
OpenGLException on error.

class  GLTexture1D: gfm.opengl.texture.GLTexture;

Wrapper for 1D texture.


this(OpenGL gl);

Creates a 1D texture.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture2D: gfm.opengl.texture.GLTexture;

Wrapper for 2D texture.


this(OpenGL gl);

Creates a 2D texture.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int height, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture3D: gfm.opengl.texture.GLTexture;

Wrapper for 3D texture.


this(OpenGL gl);

Creates a 3D texture.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int height, int depth, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture1DArray: gfm.opengl.texture.GLTexture;

Wrapper for 1D texture array.


this(OpenGL gl);

Creates a 1D texture array.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int height, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture2DArray: gfm.opengl.texture.GLTexture;

Wrapper for 2D texture array.


this(OpenGL gl);

Creates a 2D texture array.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int height, int depth, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

void  setSubImage(int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, GLenum format, GLenum type, void* data);

Sets partial texture content.

Throws
OpenGLException on error.

class  GLTextureRectangle: gfm.opengl.texture.GLTexture;

Wrapper for texture rectangle.


this(OpenGL gl);

Creates a texture rectangle.

Throws
OpenGLException on error.

void  setImage(int level, GLint internalFormat, int width, int height, int border, GLenum format, GLenum type, void* data);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture2DMultisample: gfm.opengl.texture.GLTexture;

Wrapper for 2D multisampled texture.


this(OpenGL gl);

Creates a 2D multisampled texture.

Throws
OpenGLException on error.

void  setImage(int level, int samples, GLint internalFormat, int width, int height, bool fixedsamplelocations);

Sets texture content.

Throws
OpenGLException on error.

class  GLTexture2DMultisampleArray: gfm.opengl.texture.GLTexture;

Wrapper for 2D multisampled texture array.


this(OpenGL gl);

Creates a 2D multisampled texture array.

Throws
OpenGLException on error.

void  setImage(int level, int samples, GLint internalFormat, int width, int height, int depth, bool fixedsamplelocations);

Sets texture content.

Throws
OpenGLException on error.