38 lines
698 B
C++

#pragma once
// Must be the first include
#include <glad/glad.h>
// Other includes
#include <GLFW/glfw3.h>
#include <iostream>
#include <string>
namespace Gedeng {
class Texture {
public:
struct Settings {
Settings() : mipmaps(true), transparent(false){};
bool mipmaps;
bool transparent;
};
explicit Texture(const std::string &path, Settings settings)
: id(load_texture(path, settings)), valid(false) {
}
bool is_valid() const;
// Bind a texture from the given path and return its ID
uint load_texture(const std::string &path, Settings settings);
void bind_to(int unit);
private:
const uint id;
bool valid;
};
}