MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-texture.h
Go to the documentation of this file.
1#pragma once
2
3#include "mgdl-types.h"
4#include "mgdl-util.h"
5#include "mgdl-opengl.h"
6#include "mgdl-png.h"
7
8
12struct Texture
13{
14 PNGFile* pngFile;
15
16 float aspectRatio;
17 Color4f tint;
18 GLsizei width;
19 GLsizei height;
20 ColorFormats colorFormat;
21 GLuint textureId;
22};
23typedef struct Texture Texture;
24
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
30 Texture* Texture_Create(void);
31
42 void Texture_SetGLName(Texture* img, GLuint textureName, GLsizei width, GLsizei height, ColorFormats format);
43
54 void Texture_Draw2DAligned(Texture* img, short x, short y, float scale, AlignmentModes alignX, AlignmentModes alignY);
55
65 void Texture_Draw2DAbsolute(Texture* img, short x, short y, short x2, short y2);
66
74 void Texture_Draw3D(Texture* img, float scale, AlignmentModes alignX, AlignmentModes alignY);
75
84 void Texture_SetTint(Texture* img, float red, float green, float blue);
85
86
93 Texture* Texture_LoadFile(const char* filename, TextureFilterModes filterMode);
94
101 Texture* Texture_LoadPNG(PNGFile* pngFile, TextureFilterModes filterMode);
102
108
109#ifdef __cplusplus
110}
111#endif
void Texture_Draw2DAbsolute(Texture *img, short x, short y, short x2, short y2)
Draws the image using 2D vertices.
Definition mgdl-texture.cpp:94
void Texture_SetTint(Texture *img, float red, float green, float blue)
Sets the tint of the image.
Definition mgdl-texture.cpp:206
Texture * Texture_GenerateCheckerBoard(void)
Generates a 8x8 checkerboard image.
Definition mgdl-texture.cpp:213
void Texture_SetGLName(Texture *img, GLuint textureName, GLsizei width, GLsizei height, ColorFormats format)
Sets the GL name and dimenions of the image.
Definition mgdl-texture.cpp:84
void Texture_Draw3D(Texture *img, float scale, AlignmentModes alignX, AlignmentModes alignY)
Draws the image on the origo in 3D space.
Definition mgdl-texture.cpp:150
Texture * Texture_LoadFile(const char *filename, TextureFilterModes filterMode)
Loads an image from a file.
Definition mgdl-texture.cpp:26
Texture * Texture_LoadPNG(PNGFile *pngFile, TextureFilterModes filterMode)
Loads an image from a PNG file object.
Definition mgdl-texture.cpp:44
void Texture_Draw2DAligned(Texture *img, short x, short y, float scale, AlignmentModes alignX, AlignmentModes alignY)
Draws the image using 2D vertices.
Definition mgdl-texture.cpp:124
Library types, macros, defines and enums header.
AlignmentModes
Alignment modes.
Definition mgdl-types.h:112
ColorFormats
Input color format options.
Definition mgdl-types.h:55
TextureFilterModes
Texture filter modes.
Definition mgdl-types.h:86
Definition mgdl-color.h:54
Definition mgdl-png.h:10
Abstract class for cross platform PNG image loading.
Definition mgdl-texture.h:13