Repository: glium/glium (language: rust)

Issue:
MultiOutputFrameBuffer has incorrect documentation
In the docs for the `glium::framebuffer::MultiOutputFrameBuffer` struct, it states: "This struct is useless for the moment". This made me think it wasn't possible to use it, but I noticed it was used in the `deferred` example. This documentation should be replaced with something more correct.



Discussion / hints:
Also, I have very extensively used the `MultiOutputFrameBuffer` at this point, and I can say it is definitely useful and works.
Thanks for letting me know. I was also discouraged by the doc, but now I will start using it.
PRs welcome!

Fix patch:
diff --git a/src/framebuffer/mod.rs b/src/framebuffer/mod.rs
index 26a6513799..0f618c91b2 100644
--- a/src/framebuffer/mod.rs
+++ b/src/framebuffer/mod.rs
@@ -134,7 +134,7 @@ impl<'a> SimpleFrameBuffer<'a> {
                                     Some(depth.to_depth_attachment()), None, None)
     }
 
-    /// Creates a `SimpleFrameBuffer` with a single color attachment and no depth
+    /// Creates a `SimpleFrameBuffer` with a depth buffer and no color attachment
     /// nor stencil buffer.
     #[inline]
     pub fn depth_only<F: ?Sized, D>(facade: &F, depth: D)
@@ -160,8 +160,8 @@ impl<'a> SimpleFrameBuffer<'a> {
                                     Some(stencil.to_stencil_attachment()), None)
     }
 
-    /// Creates a `SimpleFrameBuffer` with a single color attachment and no depth
-    /// nor stencil buffer.
+    /// Creates a `SimpleFrameBuffer` with a depth buffer and a stencil buffer,
+    /// but no color attachment.
     #[inline]
     pub fn depth_and_stencil_only<F: ?Sized, D, S>(facade: &F, depth: D, stencil: S)
                                            -> Result<SimpleFrameBuffer<'a>, ValidationError>
@@ -184,8 +184,8 @@ impl<'a> SimpleFrameBuffer<'a> {
                                     Some(stencil.to_stencil_attachment()), None)
     }
 
-    /// Creates a `SimpleFrameBuffer` with a single color attachment and a stencil
-    /// buffer, but no depth buffer.
+    /// Creates a `SimpleFrameBuffer` with a stencil buffer and no color attachment
+    /// nor depth buffer.
     #[inline]
     pub fn stencil_only<F: ?Sized, S>(facade: &F, stencil: S)
                               -> Result<SimpleFrameBuffer<'a>, ValidationError>
@@ -206,7 +206,7 @@ impl<'a> SimpleFrameBuffer<'a> {
                                     Some(depthstencil.to_depth_stencil_attachment()))
     }
 
-    /// Creates a `SimpleFrameBuffer` with a single color attachment and a depth-stencil buffer.
+    /// Creates a `SimpleFrameBuffer` with a depth-stencil buffer and no color attachment.
     #[inline]
     pub fn depth_stencil_only<F: ?Sized, D>(facade: &F, depthstencil: D)
                                     -> Result<SimpleFrameBuffer<'a>, ValidationError>
@@ -354,7 +354,7 @@ impl<'a> FboAttachments for SimpleFrameBuffer<'a> {
     }
 }
 
-/// This struct is useless for the moment.
+/// A framebuffer which has multiple color attachments.
 pub struct MultiOutputFrameBuffer<'a> {
     context: Rc<Context>,
     example_attachments: fbo::ValidatedAttachments<'a>,
diff --git a/src/vertex/buffer.rs b/src/vertex/buffer.rs
index f533034b1f..e10401b52c 100644
--- a/src/vertex/buffer.rs
+++ b/src/vertex/buffer.rs
@@ -238,16 +238,16 @@ impl<T> VertexBuffer<T> where T: Copy {
     /// # fn example<T>(display: glium::Display<T>) where T: SurfaceTypeTrait + ResizeableSurface {
     /// use std::borrow::Cow;
     ///
-    /// let bindings = Cow::Owned(vec![(
-    ///         Cow::Borrowed("position"), 0,
+    /// const BINDINGS: glium::vertex::VertexFormat = &[(
+    ///         Cow::Borrowed("position"), 0, -1,
     ///         glium::vertex::AttributeType::F32F32,
     ///         false,
     ///     ), (
-    ///         Cow::Borrowed("color"), 2 * ::std::mem::size_of::<f32>(),
+    ///         Cow::Borrowed("color"), 2 * ::std::mem::size_of::<f32>(), -1,
     ///         glium::vertex::AttributeType::F32,
     ///         false,
     ///     ),
-    /// ]);
+    /// ];
     ///
     /// let data = vec![
     ///     1.0, -0.3, 409.0,
@@ -255,7 +255,7 @@ impl<T> VertexBuffer<T> where T: Copy {
     /// ];
     ///
     /// let vertex_buffer = unsafe {
-    ///     glium::VertexBuffer::new_raw(&display, &data, bindings, 3 * ::std::mem::size_of::<f32>())
+    ///     glium::VertexBuffer::new_raw(&display, &data, BINDINGS, 3 * ::std::mem::size_of::<f32>())
     /// };
     /// # }
     /// ```
diff --git a/src/vertex/format.rs b/src/vertex/format.rs
index e5ec034de9..477e93a899 100644
--- a/src/vertex/format.rs
+++ b/src/vertex/format.rs
@@ -407,7 +407,8 @@ impl AttributeType {
 ///
 /// The first element is the name of the binding, the second element
 /// is the offset from the start of each vertex to this element, the
-/// third element is the type and the fourth element indicates whether
+/// third element is the layout location specified in the shader, the
+/// fourth element is the type and the fifth element indicates whether
 /// or not the element should use fixed-point normalization when
 /// binding in a VAO.
 pub type VertexFormat = &'static [(Cow<'static, str>, usize, i32, AttributeType, bool)];


Test patch: