Major artifacts in glyphs rendered by gpu_cache
I'm getting very weirdly rendered glyphs when using gpu_cache. Most of the code is wrangled from the gpu_cache example, but since I'm using just raw OpenGL, I needed to write the glium parts myself. I can't seem to find any major difference between my code and the example, but the glyphs are clearly wrong most of the time. I'm guessing the problem is in my cache_queued function, but I can't seem to identify the problem.
I'm at the point where I'm not sure the problem is in my code, or a bug, so I decided to open an issue.
The text rendering module in my project is here (relevant parts being the queue_text and draw_text functions, the rest is initialization code), and the cache_queued uploader function is here:
let upload_new_texture = |rect: Rect<u32>, data: &[u8]| unsafe {
gl::TexSubImage2D(
gl::TEXTURE_2D,
0,
rect.min.x as GLint,
rect.min.y as GLint,
rect.width() as GLint,
rect.height() as GLint,
gl::RED as GLuint,
gl::UNSIGNED_BYTE,
data.as_ptr() as *const _,
);
};
Here's a screenshot of the artifacts: