Fix glow renderer doc links

This commit is contained in:
toyboot4e 2021-09-18 14:55:55 +09:00
parent a6b61be583
commit c40be71bb4

View File

@ -1,4 +1,4 @@
//! Renderer for `[imgui-rs]` using the `[glow]` library for OpenGL. //! Renderer for [`imgui-rs`][imgui] using the [`glow`] library for OpenGL.
//! //!
//! This is heavily influenced by the //! This is heavily influenced by the
//! [example from upstream](https://github.com/ocornut/imgui/blob/fe245914114588f272b0924538fdd43f6c127a26/backends/imgui_impl_opengl3.cpp). //! [example from upstream](https://github.com/ocornut/imgui/blob/fe245914114588f272b0924538fdd43f6c127a26/backends/imgui_impl_opengl3.cpp).
@ -7,9 +7,9 @@
//! //!
//! A few code examples are provided in the source. //! A few code examples are provided in the source.
//! //!
//! In short, create either an `[AutoRenderer]` (for basic usage) or `[Renderer]` //! In short, create either an [`AutoRenderer`] (for basic usage) or [`Renderer`]
//! (for slightly more customizable operation), then call the `render(...)` //! (for slightly more customizable operation), then call the `render(...)`
//! method with draw data from `imgui-rs`. //! method with draw data from [`imgui`].
//! //!
//! # OpenGL (ES) versions //! # OpenGL (ES) versions
//! //!
@ -30,10 +30,10 @@
//! //!
//! When outputting colors to a screen, colors need to be converted from a //! When outputting colors to a screen, colors need to be converted from a
//! linear color space to a non-linear space matching the monitor (e.g. sRGB). //! linear color space to a non-linear space matching the monitor (e.g. sRGB).
//! When using the `[AutoRenderer]`, this library will convert colors to sRGB //! When using the [`AutoRenderer`], this library will convert colors to sRGB
//! as a step in the shader. When initialising a `[Renderer]`, you can choose //! as a step in the shader. When initialising a [`Renderer`], you can choose
//! whether or not to include this step in the shader or not when calling //! whether or not to include this step in the shader or not when calling
//! `[Renderer::initialize]`. //! [`Renderer::initialize`].
//! //!
//! This library also assumes that textures have their internal format //! This library also assumes that textures have their internal format
//! set appropriately when uploaded to OpenGL. That is, assuming your texture //! set appropriately when uploaded to OpenGL. That is, assuming your texture
@ -57,11 +57,11 @@ type GlUniformLocation = <Context as HasContext>::Program;
/// Renderer which owns the OpenGL context and handles textures itself. Also /// Renderer which owns the OpenGL context and handles textures itself. Also
/// converts all output colors to sRGB for display. Useful for simple applications, /// converts all output colors to sRGB for display. Useful for simple applications,
/// but more complicated applications may prefer to use `[Renderer]`, or even /// but more complicated applications may prefer to use [`Renderer`], or even
/// write their own renderer based on this code. /// write their own renderer based on this code.
/// ///
/// 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`](Self::gl_context) method.
pub struct AutoRenderer { pub struct AutoRenderer {
gl: glow::Context, gl: glow::Context,
texture_map: SimpleTextureMap, texture_map: SimpleTextureMap,
@ -86,7 +86,7 @@ impl AutoRenderer {
} }
/// 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) -> &glow::Context { pub fn gl_context(&self) -> &glow::Context {
&self.gl &self.gl
@ -534,11 +534,15 @@ impl Renderer {
/// Trait for mapping imgui texture IDs to OpenGL textures. /// Trait for mapping imgui texture IDs to OpenGL textures.
/// ///
/// `[register]` should be called after uploading a texture to OpenGL to get a /// [`register`] should be called after uploading a texture to OpenGL to get a
/// `[imgui::TextureId]` corresponding to it. /// [`imgui::TextureId`] corresponding to it.
/// ///
/// Then `[gl_texture]` can be called to find the OpenGL texture corresponding to /// [`register`]: Self::register
/// that `[imgui::TextureId]`. ///
/// Then [`gl_texture`] can be called to find the OpenGL texture corresponding to
/// that [`imgui::TextureId`].
///
/// [`gl_texture`]: Self::gl_texture
pub trait TextureMap { pub trait TextureMap {
fn register(&mut self, gl_texture: GlTexture) -> Option<imgui::TextureId>; fn register(&mut self, gl_texture: GlTexture) -> Option<imgui::TextureId>;
@ -563,7 +567,7 @@ impl TextureMap for SimpleTextureMap {
} }
} }
/// `[imgui::Textures]` is a simple choice for a texture map. /// [`imgui::Textures`] is a simple choice for a texture map.
impl TextureMap for imgui::Textures<glow::Texture> { impl TextureMap for imgui::Textures<glow::Texture> {
fn register(&mut self, gl_texture: glow::Texture) -> Option<imgui::TextureId> { fn register(&mut self, gl_texture: glow::Texture) -> Option<imgui::TextureId> {
Some(self.insert(gl_texture)) Some(self.insert(gl_texture))