Texture handling module header.
More...
#include "mgdl-types.h"
#include "mgdl-util.h"
#include "mgdl-opengl.h"
#include "mgdl-png.h"
Go to the source code of this file.
|
| struct | Texture |
| | Abstract class for cross platform PNG image loading. More...
|
| |
|
|
Texture * | Texture_Create (void) |
| |
| void | Texture_SetGLName (Texture *img, GLuint textureName, GLsizei width, GLsizei height, ColorFormats format) |
| | Sets the GL name and dimenions of the image.
|
| |
| void | Texture_Draw2DAligned (Texture *img, short x, short y, float scale, AlignmentModes alignX, AlignmentModes alignY) |
| | Draws the image using 2D vertices.
|
| |
| void | Texture_Draw2DAbsolute (Texture *img, short x, short y, short x2, short y2) |
| | Draws the image using 2D vertices.
|
| |
| void | Texture_Draw3D (Texture *img, float scale, AlignmentModes alignX, AlignmentModes alignY) |
| | Draws the image on the origo in 3D space.
|
| |
| void | Texture_SetTint (Texture *img, float red, float green, float blue) |
| | Sets the tint of the image.
|
| |
| Texture * | Texture_LoadFile (const char *filename, TextureFilterModes filterMode) |
| | Loads an image from a file.
|
| |
| Texture * | Texture_LoadPNG (PNGFile *pngFile, TextureFilterModes filterMode) |
| | Loads an image from a PNG file object.
|
| |
| Texture * | Texture_GenerateCheckerBoard (void) |
| | Generates a 8x8 checkerboard image.
|
| |
Texture handling module header.
◆ Texture_Draw2DAbsolute()
| void Texture_Draw2DAbsolute |
( |
Texture * |
img, |
|
|
short |
x, |
|
|
short |
y, |
|
|
short |
x2, |
|
|
short |
y2 |
|
) |
| |
Draws the image using 2D vertices.
This function expects the ortographic projection to be set. This function can stretch the image.
- Parameters
-
| x | Upper left corner x of the image. |
| y | Upper left corner y of the image. |
| x2 | Lower right corner x of the image. |
| y2 | Lower right corner y of the image. |
◆ Texture_Draw2DAligned()
Draws the image using 2D vertices.
This function expects the ortographic projection to be set. This function preserves the aspect ratio.
- Parameters
-
| x | Upper left corner x of the image. |
| y | Upper left corner y of the image. |
| scale | Scaling of the image. Scale of 1.0 does not alter the size. Negative scale does not flip the image. |
| alignX | Alignment on the X axis. |
| alignY | Alignment on the Y axis. |
◆ Texture_Draw3D()
Draws the image on the origo in 3D space.
This function expects the perspective projection to be set. This function preserves the aspect ratio.
- Parameters
-
| alignX | Alignment on the X axis. |
| alignY | Alignment on the Y axis. |
◆ Texture_GenerateCheckerBoard()
| Texture * Texture_GenerateCheckerBoard |
( |
void |
| ) |
|
Generates a 8x8 checkerboard image.
- Returns
- The generated image
◆ Texture_LoadFile()
Loads an image from a file.
- Parameters
-
| filename | Name of the image file. |
| filterMode | Filtering mode to use. |
- Returns
- True if loading was succesfull.
◆ Texture_LoadPNG()
Loads an image from a PNG file object.
- Parameters
-
| pngFile | PNG file object. |
| filterMode | Filtering mode to use. |
- Returns
- True if loading was succesfull.
◆ Texture_SetGLName()
| void Texture_SetGLName |
( |
Texture * |
img, |
|
|
GLuint |
textureName, |
|
|
GLsizei |
width, |
|
|
GLsizei |
height, |
|
|
ColorFormats |
format |
|
) |
| |
Sets the GL name and dimenions of the image.
This is used when the image data has already been loaded using OpenGL.
- Parameters
-
| textureName | GL name of the texture. |
| width | Width of the image in pixels. |
| height | Height of the image in pixels. |
| format | Color format of the image. |
◆ Texture_SetTint()
| void Texture_SetTint |
( |
Texture * |
img, |
|
|
float |
red, |
|
|
float |
green, |
|
|
float |
blue |
|
) |
| |
Sets the tint of the image.
This function sets the tint color. Each pixel is multiplied by the tint color. Default tint is white (1,1,1)
- Parameters
-
| red | Red component of the tint color, [0,1]. |
| green | Red component of the tint color, [0,1]. |
| blue | Red component of the tint color, [0,1]. |