cangine
Loading...
Searching...
No Matches
texture.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5namespace cangine {
12 class Texture {
13 public:
14 unsigned int ID;
15 std::string path;
17 Texture();
22 Texture(std::string path);
30 void createFromBuffer(int width, int height, unsigned char *data, bool mono = false);
35 void update(std::string path);
37 void load();
39 void bind();
41 void unbind();
42 };
43}
Wraps an OpenGL texture object.
Definition texture.hpp:12
void load()
Loads the image at path into GPU memory.
Definition texture.cpp:72
void bind()
Binds this texture for sampling.
Definition texture.cpp:64
std::string path
Definition texture.hpp:15
void unbind()
Unbinds the current texture.
Definition texture.cpp:68
void createFromBuffer(int width, int height, unsigned char *data, bool mono=false)
Creates a texture from a raw pixel buffer.
Definition texture.cpp:17
unsigned int ID
OpenGL texture object handle.
Definition texture.hpp:14
Texture()
Constructs an empty texture without loading any data.
Definition texture.cpp:8
void update(std::string path)
Replaces the texture's source image and reloads it.
Definition texture.cpp:58
Definition audiomanager.cpp:4