9 const GLenum internalFormat;
13 int dataSize()
const {
19 case GL_UNSIGNED_BYTE:
22 throw std::runtime_error(
"Unknown Texture Type");
26 int channels()
const {
37 throw std::runtime_error(
"Unknown Texture Format");
42 static const Type FP16;
43 static const Type FP16_COMPAT;
44 static const Type UI8;
50 const GLsizei _height;
51 const GLsizei _stride;
52 const GLsizei _channels;
53 const bool _use_padding;
71 _channels(type.channels()),
72 _use_padding(use_padding),
76 GLTexture(
const Type& type,
int width,
int height,
bool use_padding, GLint filter, GLint wrap)
80 use_padding ? (width + 7) / 8 * 8 : width,
86 virtual GLuint name()
const = 0;
87 virtual GLenum target()
const = 0;
88 virtual bool flipped()
const = 0;
90 virtual void map_read(std::function<
void(
const void* buffer,
95 const Type& type)> process)
const;
97 virtual void map_load(std::function<
void(
void* buffer,
102 const Type& type)> process)
const;
104 void loadData(
const void* pixels)
const;