This wraps a texture name in a convenient bow and package for GL, and mirrors an API there that starts entirely with texture. You create a texture object using the #textureNew method on the frame.
Modifying and polling texture state does not require binding beforehand and will not change your binding afterwards.
Public Member Functions | |
| this () | |
| Set the frame and allocate the name. | |
| ~this () | |
| Delete the texture name if owner is set. | |
| void | baseLevel (float value) |
| Set the minimum mipmapping level to use with the texture (default is zero). | |
| void | bind () |
| Bind the texture. | |
| void | copyImage (GLint level, GLenum format, GLint x, GLint y, GLint width, GLint height) |
| Copy a rectangle of the color buffer into the texture, replacing any data which was in there before. | |
| void | enable () |
| Enable texturing and bind this texture. | |
| void | disable () |
| Disable texturing. | |
| GLboolean | generateMipmap (GLboolean value) |
| Set whether to automatically generate mipmaps when texture data is loaded. | |
| GLint | height () |
| Get the height of the texture in pixels. | |
| GLint | height (GLint level) |
| Get the height of the texture in pixels at the specific mipmap level. | |
| void | image (GLint width, GLint height, GLenum format, GLenum type, GLvoid *data) |
| Upload image into the texture. | |
| void | image (GLenum format, out GLubyte[] pixels) |
| Read the texture image and store it in data. | |
| void | image (GLint level, GLenum format, out GLubyte[] pixels) |
| Read the texture image at a specific level and store it in data. | |
| void | magFilter (GLenum mode) |
| Set the magnification filter to either NEAREST or LINEAR. | |
| void | minFilter (GLenum mode) |
| Set the minification filter to one of NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, or LINEAR_MIPMAP_LINEAR). | |
| void | priority (GLfloat value) |
| Set the texture's residence priority. | |
| GLfloat | priority () |
| Get the texture's residence priority. | |
| GLint | width () |
| Get the width of the texture in pixels. | |
| GLint | width (GLint level) |
| Get the width of the texture in pixels at the specific mipmap level. | |
| void | wrapS (GLenum value) |
| Sets the wrap parameter for texture coordinate s to either CLAMP or REPEAT. | |
| GLenum | wrapS () |
| Get the wrap parameter for texture coordinate s. | |
| void | wrapT (GLenum value) |
| Sets the wrap parameter for texture coordinate t to either CLAMP or REPEAT. | |
| GLenum | wrapT () |
| Get the wrap parameter for texture coordinate t. | |
Public Attributes | |
| GLuint | name |
| Name of this texture. | |
| bit | owner = true |
| If owned, it can delete the texture name when deleted. | |
Static Public Attributes | |
| const GLenum | target = GL.TEXTURE_2D |
| Target type. | |
| const GLenum | target_binding = GL.TEXTURE_2D_BINDING |
| Target binding. | |
|
|
Set the minimum mipmapping level to use with the texture (default is zero). Controlling the mipmapping level can be used for visual effects, and to partially load a texture that is far away or very recently in use, and only load the real texture later. |
|
|
Bind the texture. This makes it current GL state and will be used for texturing if enable (TEXTURE_2D). |
|
||||||||||||||||||||||||||||
|
Copy a rectangle of the color buffer into the texture, replacing any data which was in there before. level is the mipmapping level to read from. format is the texture format to store and can be ALPHA, LUMINANCE, LUMINANCE_ALPHA, INTENSITY, RGB, RGBA, or a number of more obscure modes. x and y are the starting coordinates for the color buffer rectangle; a y of zero is the bottom row of the buffer. width and height are the dimensions of the rectangle and must be powers of two. |
|
|
Set whether to automatically generate mipmaps when texture data is loaded. This is dependent on the SGIS_generate_mipmap extension, so it returns whether the extension was available. "value" is whether to enable mipmap generation. |
|
||||||||||||||||||||||||
|
Upload image into the texture. width and height are the dimensions of the texture in pixels. format is the provided channels and can be COLOR_INDEX, RED, GREEN, BLUE, ALPHA, RGB, RGBA, LUMINANCE, and LUMINANCE_ALPHA. type is the data type and can be UNSIGNED_BYTE (GLubyte), BYTE (GLbyte), BITMAP (compressed bits, format must be COLOR_INDEX), UNSIGNED_SHORT (GLushort), SHORT (GLshort), UNSIGNED_INT (GLuint), INT (GLint), and FLOAT (GLfloat). pixels is the array to read from; if null, the texture dimensions are set but are not cleared. The image is loaded from the bottom up, so the first pixel in the pixels array is the bottom-left one. If the width and height are not powers of two (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, or 8192), the image is first resized to the nearest demarcation. Then it is checked whether it fits, and is progressively halved in size until it does. Mipmaps are automatically generated, either manually or by extension. |
|
|
Set the magnification filter to either NEAREST or LINEAR. The magnification filter is used when the pixel is smaller than a texture element. It can be one of:
|
|
|
Set the minification filter to one of NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, or LINEAR_MIPMAP_LINEAR). The minification filter is used when the pixel is larger than a texture element. It can be one of:
LINEAR is often called bilinear filtering, while LINEAR_MIPMAP_LINEAR is often called trilinear filtering. NEAREST and LINEAR are often slower than the other forms due to what's called cache thrashing: too much access to widely spaced sections of memory. |
|
|
Sets the wrap parameter for texture coordinate s to either CLAMP or REPEAT. CLAMP causes s coordinates to be clamped to the range [0, 1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to CLAMP. Initially, wrapS is set to REPEAT. |
|
|
Sets the wrap parameter for texture coordinate t to either CLAMP or REPEAT. CLAMP causes t coordinates to be clamped to the range [0, 1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. REPEAT causes the integer part of the t coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to CLAMP. Initially, wrapT is set to REPEAT. |
1.3.2