|
|
|
@@ -48,6 +48,7 @@ impl TextManager { |
|
|
|
let vfs = world.resource::<Vfs>()?.deref().clone(); |
|
|
|
let program = world.load_program(vec![ |
|
|
|
(Type::Vertex, "resources/shader/text/vert.glsl"), |
|
|
|
(Type::Geometry, "resources/shader/text/geom.glsl"), |
|
|
|
(Type::Fragment, "resources/shader/text/frag.glsl"), |
|
|
|
])?; |
|
|
|
let program = Rc::new(program); |
|
|
|
@@ -595,15 +596,10 @@ impl Text { |
|
|
|
let array = VertexArray::builder() |
|
|
|
.bind_buffer(buffer) |
|
|
|
.vertex_attrib_pointer(0, 2, DataType::Float, false, STRIDE, OFFSET_POS_MIN)? |
|
|
|
.vertex_attrib_divisor(1)? |
|
|
|
.vertex_attrib_pointer(1, 2, DataType::Float, false, STRIDE, OFFSET_POS_MAX)? |
|
|
|
.vertex_attrib_divisor(1)? |
|
|
|
.vertex_attrib_pointer(2, 2, DataType::Float, false, STRIDE, OFFSET_TEX_MIN)? |
|
|
|
.vertex_attrib_divisor(1)? |
|
|
|
.vertex_attrib_pointer(3, 2, DataType::Float, false, STRIDE, OFFSET_TEX_MAX)? |
|
|
|
.vertex_attrib_divisor(1)? |
|
|
|
.vertex_attrib_pointer(4, 4, DataType::Float, false, STRIDE, OFFSET_COLOR)? |
|
|
|
.vertex_attrib_divisor(1)? |
|
|
|
.build()?; |
|
|
|
|
|
|
|
let cache = cache.clone(); |
|
|
|
@@ -647,7 +643,9 @@ impl Text { |
|
|
|
.uniform(2, Uniform::Vector2f(pos)) |
|
|
|
.warn("Unable to update text offset"); |
|
|
|
|
|
|
|
gl::draw_arrays_instanced(gl::TRIANGLE_STRIP, 0, 4, inner.vertex_count as _); |
|
|
|
// gl::draw_arrays(gl::POINTS, 0, inner.vertex_count as _); |
|
|
|
gl::draw_arrays(gl::POINTS, 0, inner.vertex_count as _); |
|
|
|
// gl::draw_arrays_instanced(gl::POINTS, 0, 1, inner.vertex_count as _); |
|
|
|
} |
|
|
|
|
|
|
|
pub fn update<S>(&mut self, mut index: usize, text: S) -> Result<&Self, Error> |
|
|
|
|