Attempt to start documenting better

This commit is contained in:
John-Mark Allen 2021-06-09 23:21:52 +01:00 committed by Jack Spira
parent f92e9c4beb
commit cdf90639c6

View File

@ -9,9 +9,9 @@ pub mod versions;
// TODO: document all the things! // TODO: document all the things!
// This may be generics overkill, but I have to assume there's some reason that // This may be generics overkill, but I have to assume there's some reason that
// `glow` hid the functions of `Context` behind the `HasContext` trait. The // `glow` hid the functions of `[glow::Context]` behind the `[glow::Context]`
// specified types I require here are necessary because otherwise I can't // trait. The specified types required here are necessary because otherwise
// perform the required initialisations or conversions in the code below. In // required initialisations or conversions in this crate can't be performed. In
// any case, the OpenGL standard specifies these types, so there should be no // any case, the OpenGL standard specifies these types, so there should be no
// loss of generality. // loss of generality.
pub trait Gl: pub trait Gl:
@ -41,7 +41,7 @@ impl<
/// Convenience function to get you going quickly. In most larger programs /// Convenience function to get you going quickly. In most larger programs
/// you probably want to take more control (including ownership of the GL /// you probably want to take more control (including ownership of the GL
/// context). In those cases, construct an appropriate renderer with /// context). In those cases, construct an appropriate renderer with
/// `RendererBuilder`. /// `[RendererBuilder]`.
/// ///
/// By default, it constructs a renderer which owns the OpenGL context and /// By default, it constructs a renderer which owns the OpenGL context and
/// attempts to backup the OpenGL state before rendering and restore it after /// attempts to backup the OpenGL state before rendering and restore it after
@ -165,7 +165,7 @@ where
/// OpenGL context, or even change that context at runtime. /// OpenGL context, or even change that context at runtime.
/// ///
/// OpenGL context is still available to the rest of the application through /// OpenGL context is still available to the rest of the application through
/// the `gl_context` method. /// the `[gl_context]` method.
pub struct OwningRenderer<G, T = TrivialTextureMap, S = AutoShaderProvider<G>, C = TrivialCsm> pub struct OwningRenderer<G, T = TrivialTextureMap, S = AutoShaderProvider<G>, C = TrivialCsm>
where where
G: Gl, G: Gl,
@ -185,7 +185,7 @@ where
C: ContextStateManager<G>, C: ContextStateManager<G>,
{ {
/// Note: no need to provide a `mut` version of this, as all methods on /// Note: no need to provide a `mut` version of this, as all methods on
/// `glow::HasContext` are immutable. /// `[glow::HasContext]` are immutable.
#[inline] #[inline]
pub fn gl_context(&self) -> &G { pub fn gl_context(&self) -> &G {
&self.gl &self.gl
@ -669,14 +669,14 @@ pub struct TrivialCsm();
impl<G: Gl> ContextStateManager<G> for TrivialCsm {} impl<G: Gl> ContextStateManager<G> for TrivialCsm {}
/// This `ContextStateManager` is based on the upstream OpenGL example from /// This `[ContextStateManager]` is based on the upstream OpenGL example from
/// imgui, where an attempt is made to save and restore the OpenGL context state /// imgui, where an attempt is made to save and restore the OpenGL context state
/// before and after rendering. /// before and after rendering.
/// ///
/// It is unlikely that any such attempt will be comprehensive for all possible /// It is unlikely that any such attempt will be comprehensive for all possible
/// applications, due to the complexity of OpenGL and the possibility of /// applications, due to the complexity of OpenGL and the possibility of
/// arbitrary extensions. However, it remains as a useful tool for quickly /// arbitrary extensions. However, it remains as a useful tool for quickly
/// getting started, and a good example of how to use a `ContextStateManager` to /// getting started, and a good example of how to use a `[ContextStateManager]` to
/// customise the renderer. /// customise the renderer.
#[allow(clippy::struct_excessive_bools)] #[allow(clippy::struct_excessive_bools)]
#[derive(Default)] #[derive(Default)]
@ -859,7 +859,7 @@ pub trait ShaderProvider<G: Gl> {
/// OpenGL context. /// OpenGL context.
/// ///
/// Implementors should use this opporunity to check whether the version of /// Implementors should use this opporunity to check whether the version of
/// the GL context (found with `GlVersion::read`) is compatible with the /// the GL context (found with `[GlVersion::read]`) is compatible with the
/// shader they provide. /// shader they provide.
/// ///
/// # Errors /// # Errors