- size_t chroma_width = width / 2;
-
- const uint8_t *y = (const uint8_t *)contents;
- const uint8_t *cb = (const uint8_t *)contents + width * height;
- const uint8_t *cr = (const uint8_t *)contents + width * height + chroma_width * height;
+ GLuint tex;
+ glCreateTextures(GL_TEXTURE_2D, 1, &tex);
+ check_error();
+ glTextureStorage2D(tex, 1, GL_R8, width, height);
+ check_error();
+ glCopyImageSubData(src_tex, GL_TEXTURE_2D, 0, 0, 0, 0,
+ tex, GL_TEXTURE_2D, 0, 0, 0, 0,
+ width, height, 1);
+ check_error();
+ glTextureParameteri(tex, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ check_error();
+ glTextureParameteri(tex, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ check_error();
+ glTextureParameteri(tex, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ check_error();
+ glTextureParameteri(tex, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ check_error();