-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexture.h
More file actions
38 lines (33 loc) · 1.32 KB
/
texture.h
File metadata and controls
38 lines (33 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef TEXTURE_H
#define TEXTURE_H
#include <string>
#include <iostream>
#include "stb_image.h"
#include <glad/glad.h>
// Texture2D is able to store and configure a texture in OpenGL.
// It also hosts utility functions for easy management.
class Texture2D
{
public:
// holds the ID of the texture object, used for all texture operations to reference to this particular texture
unsigned int ID;
// texture image dimensions
int Width, Height; // width and height of loaded image in pixels
// texture Format
unsigned int Internal_Format; // format of texture object
unsigned int Image_Format; // format of loaded image
// texture configuration
unsigned int Wrap_S; // wrapping mode on S axis
unsigned int Wrap_T; // wrapping mode on T axis
unsigned int Filter_Min; // filtering mode if texture pixels < screen pixels
unsigned int Filter_Max; // filtering mode if texture pixels > screen pixels
// constructor (sets default texture modes)
Texture2D();
// generates texture from image data
void Generate(std::string path, bool alpha);
// reserves memory for a texture of a specified width and height
void Reserve(unsigned int widht, unsigned int height, bool alpha = true);
// binds the texture as the current active GL_TEXTURE_2D texture object
void Bind() const;
};
#endif