|
@ -0,0 +1,34 @@ |
|
|
|
|
|
use glium::Program;
|
|
|
|
|
|
use glium::backend::Facade;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
|
|
struct Vertex {
|
|
|
|
|
|
position: [u32; 2],
|
|
|
|
|
|
tex_coords: [u32; 2],
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
implement_vertex!(Vertex, position, tex_coords);
|
|
|
|
|
|
|
|
|
|
|
|
static SHADER_FRAG_140: &'static str = include_str!("gl_renderer_140.frag");
|
|
|
|
|
|
static SHADER_VERT_140: &'static str = include_str!("gl_renderer_140.vert");
|
|
|
|
|
|
|
|
|
|
|
|
pub struct TextRenderer {
|
|
|
|
|
|
gl_program: Program,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl TextRenderer {
|
|
|
|
|
|
pub fn new<F>(display: &F) -> TextRenderer where F: Facade {
|
|
|
|
|
|
let program = program!(display,
|
|
|
|
|
|
140 => {
|
|
|
|
|
|
vertex: SHADER_VERT_140,
|
|
|
|
|
|
fragment: SHADER_FRAG_140,
|
|
|
|
|
|
},
|
|
|
|
|
|
).expect("textium: could not compile glium renderer shaders");
|
|
|
|
|
|
|
|
|
|
|
|
TextRenderer {
|
|
|
|
|
|
gl_program: program,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// pub fn draw(text: RenderableText)
|
|
|
|
|
|
}
|