OGL Engine 1.2.0-dev
Loading...
Searching...
No Matches
texture.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <iostream>
9#include <glad/glad.h>
10
11#include <glm/glm.hpp>
12
13namespace Engine::Graphics {
18 class Texture {
19 private:
21 GLuint mID;
23 void Build(unsigned char *data, int width, int height, int channels);
24
25 public:
27 GLenum glWrappingMode = GL_REPEAT;
28
34 Texture(const std::string& path);
41 Texture(const char *buffer, size_t size);
45 Texture();
50 ~Texture();
51
57 glm::ivec2 GetSize();
58
64 void LoadFromFile(const std::string& path);
71 void LoadFromMemory(const char *buffer, size_t size);
72
78 GLuint Get() const;
84 void Bind(int unit = 0) const;
85 };
86}
Texture(const std::string &path)
Construit un nouvel objet Texture et charge la texture demandée.
Definition texture.cpp:11
void LoadFromFile(const std::string &path)
Charge un fichier texture et construit la texture OpenGL.
Definition texture.cpp:43
~Texture()
Détruit proprement la texture.
Definition texture.cpp:17
GLuint Get() const
Renvoie l'identifiant de la texture.
Definition texture.cpp:80
Texture()
Construit un nouvel object Texture vide.
Definition texture.cpp:10
void Bind(int unit=0) const
Lie la texture à l'unité demandée.
Definition texture.cpp:84
void LoadFromMemory(const char *buffer, size_t size)
Charge une texture depuis le buffer donné
Definition texture.cpp:62
GLenum glWrappingMode
Le mode de wrapping de la texture openGL (cf. doc opengl pour les options possibles)
Definition texture.hpp:27
glm::ivec2 GetSize()
Renvoie la taille de la texture.
Definition texture.cpp:24
Definition material.cpp:3