Hi, I've been programming with glium since a few days, and I have a error that I can't find any way to solve. My code:
pub fn indices_and_vertices(
&self,
display: &glium::Display,
) -> (glium::VertexBuffer<Vertex>, glium::IndexBuffer<u32>) {
let mut indices = glium::IndexBuffer::<u32>::empty(
display,
glium::index::PrimitiveType::TrianglesList,
0,
)
.unwrap();
let mut vertices = glium::VertexBuffer::<Vertex>::empty(display, 0).unwrap();
for shape in self.shapes {
let (shape_vertices, shape_indices) = shape.indices_and_vertices(&display);
shape_vertices.copy_to(vertices);
}
(vertices, indices)
}
The error:
error[E0277]: the trait bound `BufferViewSlice<'_, [world::Vertex]>: From<glium::VertexBuffer<world::Vertex>>` is not satisfied
--> src\world.rs:95:28
|
95 | shape_vertices.copy_to(vertices);
| ^^^^^^^ the trait `From<glium::VertexBuffer<world::Vertex>>` is not implemented for `BufferViewSlice<'_, [world::Vertex]>`
|
= help: the following implementations were found:
<BufferViewSlice<'a, T> as From<&'a Buffer<T>>>
<BufferViewSlice<'a, T> as From<&'a glium::uniforms::UniformBuffer<T>>>
<BufferViewSlice<'a, T> as From<&'a mut Buffer<T>>>
<BufferViewSlice<'a, T> as From<BufferViewMutSlice<'a, T>>>
and 6 others
= note: required because of the requirements on the impl of `Into<BufferViewSlice<'_, [world::Vertex]>>` for `glium::VertexBuffer<world::Vertex>`
Thanks for taking the time to read my post
Edit: I want to copy the shape_vertices
Buffer into the vertices
Buffer